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 |