Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2138)

Unified Diff: content/renderer/browser_plugin/browser_plugin_bindings.cc

Issue 10965017: Browser Plugin: Implement getProcessId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin_bindings.cc
diff --git a/content/renderer/browser_plugin/browser_plugin_bindings.cc b/content/renderer/browser_plugin/browser_plugin_bindings.cc
index 0479550c5779355c2fabfea2a3b42bcb8fb9cc2c..aaa7ba97310e32e78c369a0defb5d8e7196cb84a 100644
--- a/content/renderer/browser_plugin/browser_plugin_bindings.cc
+++ b/content/renderer/browser_plugin/browser_plugin_bindings.cc
@@ -39,6 +39,7 @@ namespace content {
namespace {
const char kAddEventListener[] = "addEventListener";
+const char kGetProcessId[] = "getProcessId";
const char kReloadMethod[] = "reload";
const char kRemoveEventListener[] = "removeEventListener";
const char kSrcAttribute[] = "src";
@@ -65,6 +66,10 @@ bool IdentifierIsRemoveEventListener(NPIdentifier identifier) {
return WebBindings::getStringIdentifier(kRemoveEventListener) == identifier;
}
+bool IdentifierIsGetProcessID(NPIdentifier identifier) {
+ return WebBindings::getStringIdentifier(kGetProcessId) == identifier;
+}
+
bool IdentifierIsSrcAttribute(NPIdentifier identifier) {
return WebBindings::getStringIdentifier(kSrcAttribute) == identifier;
}
@@ -119,13 +124,16 @@ bool BrowserPluginBindingsHasMethod(NPObject* np_obj, NPIdentifier name) {
if (IdentifierIsAddEventListener(name))
return true;
- if (IdentifierIsRemoveEventListener(name))
+ if (IdentifierIsGetProcessID(name))
return true;
- if (IdentifierIsStop(name))
+ if (IdentifierIsReload(name))
return true;
- if (IdentifierIsReload(name))
+ if (IdentifierIsRemoveEventListener(name))
+ return true;
+
+ if (IdentifierIsStop(name))
return true;
return false;
@@ -155,6 +163,18 @@ bool BrowserPluginBindingsInvoke(NPObject* np_obj, NPIdentifier name,
return bindings->instance()->AddEventListener(event_name, function);
}
+ if (IdentifierIsGetProcessID(name) && !arg_count) {
+ int process_id = bindings->instance()->process_id();
+ result->type = NPVariantType_Int32;
+ result->value.intValue = process_id;
+ return true;
+ }
+
+ if (IdentifierIsReload(name) && !arg_count) {
+ bindings->instance()->Reload();
+ return true;
+ }
+
if (IdentifierIsRemoveEventListener(name) && arg_count == 2) {
std::string event_name = StringFromNPVariant(args[0]);
if (event_name.empty())
@@ -175,11 +195,6 @@ bool BrowserPluginBindingsInvoke(NPObject* np_obj, NPIdentifier name,
return true;
}
- if (IdentifierIsReload(name) && !arg_count) {
- bindings->instance()->Reload();
- return true;
- }
-
return false;
}
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.cc ('k') | content/renderer/browser_plugin/browser_plugin_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698