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

Unified Diff: chrome/renderer/extensions/runtime_custom_bindings.cc

Issue 16174005: Implement externally_connectable! Web pages can now communicate directly with (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: absolute path... Created 7 years, 6 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: chrome/renderer/extensions/runtime_custom_bindings.cc
diff --git a/chrome/renderer/extensions/runtime_custom_bindings.cc b/chrome/renderer/extensions/runtime_custom_bindings.cc
index 0f4801fbc6ad3b93bb46297e8c3e7ca2bc92f2c4..587fcb738069487b719ee9ea1d3f47289938f17e 100644
--- a/chrome/renderer/extensions/runtime_custom_bindings.cc
+++ b/chrome/renderer/extensions/runtime_custom_bindings.cc
@@ -47,16 +47,14 @@ v8::Handle<v8::Value> RuntimeCustomBindings::OpenChannelToExtension(
return v8::Undefined();
// The Javascript code should validate/fill the arguments.
- CHECK(args.Length() >= 3 &&
- args[0]->IsString() &&
- args[1]->IsString() &&
- args[2]->IsString());
+ CHECK_EQ(2, args.Length());
+ CHECK(args[0]->IsString() && args[1]->IsString());
ExtensionMsg_ExternalConnectionInfo info;
- info.source_id = *v8::String::Utf8Value(args[0]->ToString());
- info.target_id = *v8::String::Utf8Value(args[1]->ToString());
+ info.source_id = context()->extension() ? context()->extension()->id() : "";
+ info.target_id = *v8::String::Utf8Value(args[0]->ToString());
info.source_url = renderview->GetWebView()->mainFrame()->document().url();
- std::string channel_name = *v8::String::Utf8Value(args[2]->ToString());
+ std::string channel_name = *v8::String::Utf8Value(args[1]->ToString());
int port_id = -1;
renderview->Send(new ExtensionHostMsg_OpenChannelToExtension(
renderview->GetRoutingID(), info, channel_name, &port_id));
@@ -103,4 +101,4 @@ v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest(
context()->v8_context());
}
-} // extensions
+} // namespace extensions
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | chrome/renderer/resources/extensions/miscellaneous_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698