Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/browser-plugin/scriptable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'browser-plugin/scriptable.cpp')
-rw-r--r--browser-plugin/scriptable.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/browser-plugin/scriptable.cpp b/browser-plugin/scriptable.cpp
index 6272c7d..e8fbcb2 100644
--- a/browser-plugin/scriptable.cpp
+++ b/browser-plugin/scriptable.cpp
@@ -197,6 +197,7 @@ ScriptablePluginObject::ScriptablePluginObject (NPP npp) :
mMagicWrapper(0)
{
mTitleID = NPN_GetStringIdentifier ("title");
+ mZoomID = NPN_GetStringIdentifier ("zoom");
mMagicWrapperID = NPN_GetStringIdentifier ("magicWrapper");
mZoomInID = NPN_GetStringIdentifier ("zoomIn");
@@ -229,6 +230,7 @@ ScriptablePluginObject::HasProperty (NPIdentifier name)
{
NPIdentifier properties[] = {
mTitleID,
+ mZoomID,
mMagicWrapperID
};
@@ -256,6 +258,9 @@ ScriptablePluginObject::GetProperty (NPIdentifier name, NPVariant *result)
}
return true;
+ } else if (name == mZoomID) {
+ DOUBLE_TO_NPVARIANT (plugin->GetZoom(), *result);
+ return true;
}
return false;
@@ -292,6 +297,19 @@ ScriptablePluginObject::SetProperty (NPIdentifier name, const NPVariant *value)
}
return true;
+ } else if (name == mZoomID) {
+ double zoom;
+ if (NPVARIANT_IS_DOUBLE (*value)) {
+ zoom = NPVARIANT_TO_DOUBLE (*value);
+ } else if (NPVARIANT_IS_INT32 (*value)) {
+ zoom = NPVARIANT_TO_INT32 (*value);
+ } else {
+ NPN_SetException (this, "Invalid type for zoom, expected a number");
+ return false;
+ }
+
+ plugin->SetZoom (zoom);
+ return true;
}
return false;