Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--browser-plugin/plugin.cpp9
-rw-r--r--browser-plugin/plugin.h2
-rw-r--r--browser-plugin/scriptable.cpp16
-rw-r--r--browser-plugin/scriptable.h2
4 files changed, 29 insertions, 0 deletions
diff --git a/browser-plugin/plugin.cpp b/browser-plugin/plugin.cpp
index db1f4f5..978f9c0 100644
--- a/browser-plugin/plugin.cpp
+++ b/browser-plugin/plugin.cpp
@@ -161,6 +161,15 @@ Plugin::GetScriptableNPObject ()
}
void
+Plugin::CallBrowser(const char *function_name)
+{
+ ScriptablePluginObject *obj = static_cast<ScriptablePluginObject*> (mScriptableObject);
+ if (obj) {
+ obj->CallBrowser (function_name);
+ }
+}
+
+void
Plugin::UpdateSizingMode ()
{
EvSizingMode sizingMode;
diff --git a/browser-plugin/plugin.h b/browser-plugin/plugin.h
index 58fbc96..95c53ef 100644
--- a/browser-plugin/plugin.h
+++ b/browser-plugin/plugin.h
@@ -44,6 +44,8 @@ class Plugin {
void UpdateSizingMode ();
void ClearLoadJob ();
+ void CallBrowser (const char *function_name);
+
static void SizingModeCallback (EvView *view,
GParamSpec *pspec,
gpointer data);
diff --git a/browser-plugin/scriptable.cpp b/browser-plugin/scriptable.cpp
index 0be9736..ff4f064 100644
--- a/browser-plugin/scriptable.cpp
+++ b/browser-plugin/scriptable.cpp
@@ -293,6 +293,22 @@ ScriptablePluginObject::SetProperty (NPIdentifier name, const NPVariant *value)
return false;
}
+void
+ScriptablePluginObject::CallBrowser (const char *function_name)
+{
+ if (!mMagicWrapper) {
+ return;
+ }
+
+ NPVariant rval;
+
+ if (NPERR_NO_ERROR == NPN_Invoke (mNpp, mMagicWrapper,
+ NPN_GetStringIdentifier (function_name),
+ NULL, 0, &rval)) {
+ NPN_ReleaseVariantValue (&rval);
+ }
+}
+
bool
ScriptablePluginObject::Invoke (NPIdentifier name, const NPVariant *args,
uint32_t argCount, NPVariant *result)
diff --git a/browser-plugin/scriptable.h b/browser-plugin/scriptable.h
index 4a96b77..79a9519 100644
--- a/browser-plugin/scriptable.h
+++ b/browser-plugin/scriptable.h
@@ -89,6 +89,8 @@ class ScriptablePluginObject : public ScriptablePluginObjectBase
virtual bool InvokeDefault (const NPVariant *args, uint32_t argCount,
NPVariant *result);
+ virtual void CallBrowser (const char *function_name);
+
private:
NPIdentifier mTitleID;
NPIdentifier mMagicWrapperID;