summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 18:13:27 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 18:13:27 +0000
commitea4d0790da2db4aae00e07af25feffd7e3857377 (patch)
tree44af49f6bd1432124069d2bba095ac49f9fc2af3 /chrome/renderer/extensions
parent76624fdeda4c8409a6bfd8a5f48de00dbceb0760 (diff)
downloadchromium_src-ea4d0790da2db4aae00e07af25feffd7e3857377.zip
chromium_src-ea4d0790da2db4aae00e07af25feffd7e3857377.tar.gz
chromium_src-ea4d0790da2db4aae00e07af25feffd7e3857377.tar.bz2
Implement chrome.extension.connectExternal and fix various API inconsistencies.
BUG=23583 BUG=17910 TEST=no Review URL: http://codereview.chromium.org/262016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions')
-rw-r--r--chrome/renderer/extensions/bindings_utils.h5
-rw-r--r--chrome/renderer/extensions/renderer_extension_bindings.cc11
2 files changed, 12 insertions, 4 deletions
diff --git a/chrome/renderer/extensions/bindings_utils.h b/chrome/renderer/extensions/bindings_utils.h
index b0b3f08..471023c 100644
--- a/chrome/renderer/extensions/bindings_utils.h
+++ b/chrome/renderer/extensions/bindings_utils.h
@@ -28,6 +28,11 @@ class ExtensionBase : public v8::Extension {
const char** deps)
: v8::Extension(name, source, dep_count, deps) {}
+ // Note: do not call this function before or during the chromeHidden.onLoad
+ // event dispatch. The URL might not have been committed yet and might not
+ // be an extension URL.
+ static std::string ExtensionIdForCurrentContext();
+
// Derived classes should call this at the end of their implementation in
// order to expose common native functions, like GetChromeHidden, to the
// v8 extension.
diff --git a/chrome/renderer/extensions/renderer_extension_bindings.cc b/chrome/renderer/extensions/renderer_extension_bindings.cc
index 374e673..de958d1 100644
--- a/chrome/renderer/extensions/renderer_extension_bindings.cc
+++ b/chrome/renderer/extensions/renderer_extension_bindings.cc
@@ -77,12 +77,15 @@ class ExtensionImpl : public ExtensionBase {
if (!renderview)
return v8::Undefined();
- if (args.Length() >= 2 && args[0]->IsString() && args[1]->IsString()) {
- std::string id = *v8::String::Utf8Value(args[0]->ToString());
- std::string channel_name = *v8::String::Utf8Value(args[1]->ToString());
+ if (args.Length() >= 3 && args[0]->IsString() && args[1]->IsString() &&
+ args[2]->IsString()) {
+ std::string source_id = *v8::String::Utf8Value(args[0]->ToString());
+ std::string target_id = *v8::String::Utf8Value(args[1]->ToString());
+ std::string channel_name = *v8::String::Utf8Value(args[2]->ToString());
int port_id = -1;
renderview->Send(new ViewHostMsg_OpenChannelToExtension(
- renderview->routing_id(), id, channel_name, &port_id));
+ renderview->routing_id(), source_id, target_id,
+ channel_name, &port_id));
return v8::Integer::New(port_id);
}
return v8::Undefined();