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

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

Issue 10829225: Browser Plugin: Add HTML5-like postMessage support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 2 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 bf948525ceeb166fd3fa699fa72a7f225e5c0fee..b0dfca7c707127617103d124c13298cfbf8b7d2b 100644
--- a/content/renderer/browser_plugin/browser_plugin_bindings.cc
+++ b/content/renderer/browser_plugin/browser_plugin_bindings.cc
@@ -41,6 +41,7 @@ const char kAddEventListener[] = "addEventListener";
const char kBackMethod[] = "back";
const char kCanGoBack[] = "canGoBack";
const char kCanGoForward[] = "canGoForward";
+const char kContentWindow[] = "contentWindow";
const char kForwardMethod[] = "forward";
const char kGetProcessId[] = "getProcessId";
const char kGoMethod[] = "go";
@@ -56,6 +57,10 @@ BrowserPluginBindings* GetBindings(NPObject* object) {
message_channel;
}
+bool IdentifierIsContentWindow(NPIdentifier identifier) {
+ return WebBindings::getStringIdentifier(kContentWindow) == identifier;
+}
+
bool IdentifierIsPartitionAttribute(NPIdentifier identifier) {
return WebBindings::getStringIdentifier(kPartitionAttribute) == identifier;
}
@@ -141,6 +146,7 @@ bool BrowserPluginBindingsInvokeDefault(NPObject* np_obj,
bool BrowserPluginBindingsHasProperty(NPObject* np_obj, NPIdentifier name) {
return IdentifierIsSrcAttribute(name) ||
+ IdentifierIsContentWindow(name) ||
IdentifierIsPartitionAttribute(name);
}
@@ -163,6 +169,15 @@ bool BrowserPluginBindingsGetProperty(NPObject* np_obj, NPIdentifier name,
return StringToNPVariant(src, result);
}
+ if (IdentifierIsContentWindow(name)) {
+ NPObject* obj = bindings->instance()->GetContentWindow();
+ if (obj) {
+ result->type = NPVariantType_Object;
+ result->value.objectValue = WebBindings::retainObject(obj);
+ }
+ return true;
+ }
+
if (IdentifierIsPartitionAttribute(name)) {
std::string partition_id = bindings->instance()->GetPartitionAttribute();
return StringToNPVariant(partition_id, result);
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.cc ('k') | content/renderer/browser_plugin/browser_plugin_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698