summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-26 18:04:02 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-26 18:04:02 +0000
commit24b74f28711d41a403438b845c6835aefb2c4f93 (patch)
tree0405e4506e1dfe1fa46b584caab3aa427e4652ff /chrome/renderer
parent7cac526e260a4b0d5a426e9326c5b06ca76951bc (diff)
downloadchromium_src-24b74f28711d41a403438b845c6835aefb2c4f93.zip
chromium_src-24b74f28711d41a403438b845c6835aefb2c4f93.tar.gz
chromium_src-24b74f28711d41a403438b845c6835aefb2c4f93.tar.bz2
Revert 156678 - Native messaging now uses the MessageService back-end.
Reason: Regression in a ChromeOS extension causing it to continue running after unloading. BUG=142915 Review URL: https://codereview.chromium.org/10818013 TBR=eaugusti@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158830 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/extensions/extension_custom_bindings.cc34
-rw-r--r--chrome/renderer/extensions/extension_custom_bindings.h3
-rw-r--r--chrome/renderer/resources/extensions/extension_custom_bindings.js44
-rw-r--r--chrome/renderer/resources/extensions/miscellaneous_bindings.js6
4 files changed, 3 insertions, 84 deletions
diff --git a/chrome/renderer/extensions/extension_custom_bindings.cc b/chrome/renderer/extensions/extension_custom_bindings.cc
index e3c5afc..685c180 100644
--- a/chrome/renderer/extensions/extension_custom_bindings.cc
+++ b/chrome/renderer/extensions/extension_custom_bindings.cc
@@ -15,7 +15,6 @@
#include "chrome/renderer/extensions/dispatcher.h"
#include "chrome/renderer/extensions/extension_helper.h"
#include "content/public/renderer/render_view.h"
-#include "content/public/renderer/v8_value_converter.h"
#include "grit/renderer_resources.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
@@ -32,7 +31,6 @@ ExtensionCustomBindings::ExtensionCustomBindings(Dispatcher* dispatcher)
: ChromeV8Extension(dispatcher) {
RouteStaticFunction("GetExtensionViews", &GetExtensionViews);
RouteStaticFunction("OpenChannelToExtension", &OpenChannelToExtension);
- RouteStaticFunction("OpenChannelToNativeApp", &OpenChannelToNativeApp);
}
// static
@@ -125,36 +123,4 @@ v8::Handle<v8::Value> ExtensionCustomBindings::OpenChannelToExtension(
return v8::Integer::New(port_id);
}
-// static
-v8::Handle<v8::Value> ExtensionCustomBindings::OpenChannelToNativeApp(
- const v8::Arguments& args) {
- // Get the current RenderView so that we can send a routed IPC message from
- // the correct source.
- content::RenderView* renderview = GetCurrentRenderView();
- if (!renderview)
- return v8::Undefined();
-
- // The Javascript code should validate/fill the arguments.
- CHECK(args.Length() >= 3 &&
- args[0]->IsString() &&
- args[1]->IsString() &&
- args[2]->IsString() &&
- args[3]->IsString());
-
- std::string extension_id = *v8::String::Utf8Value(args[0]->ToString());
- std::string native_app_name = *v8::String::Utf8Value(args[1]->ToString());
- std::string channel_name = *v8::String::Utf8Value(args[2]->ToString());
- std::string connect_message = *v8::String::Utf8Value(args[3]->ToString());
-
- int port_id = -1;
- renderview->Send(new ExtensionHostMsg_OpenChannelToNativeApp(
- renderview->GetRoutingID(),
- extension_id,
- native_app_name,
- channel_name,
- connect_message,
- &port_id));
- return v8::Integer::New(port_id);
-}
-
} // namespace extensions
diff --git a/chrome/renderer/extensions/extension_custom_bindings.h b/chrome/renderer/extensions/extension_custom_bindings.h
index 3bc29ee..682b001 100644
--- a/chrome/renderer/extensions/extension_custom_bindings.h
+++ b/chrome/renderer/extensions/extension_custom_bindings.h
@@ -21,9 +21,6 @@ class ExtensionCustomBindings : public ChromeV8Extension {
// Creates a new messaging channel to the given extension.
static v8::Handle<v8::Value> OpenChannelToExtension(
const v8::Arguments& args);
-
- static v8::Handle<v8::Value> OpenChannelToNativeApp(
- const v8::Arguments& args);
};
} // namespace extensions
diff --git a/chrome/renderer/resources/extensions/extension_custom_bindings.js b/chrome/renderer/resources/extensions/extension_custom_bindings.js
index 551e103..be19e9c 100644
--- a/chrome/renderer/resources/extensions/extension_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/extension_custom_bindings.js
@@ -7,7 +7,6 @@
var extensionNatives = requireNative('extension');
var GetExtensionViews = extensionNatives.GetExtensionViews;
var OpenChannelToExtension = extensionNatives.OpenChannelToExtension;
-var OpenChannelToNativeApp = extensionNatives.OpenChannelToNativeApp;
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
@@ -94,8 +93,6 @@ chromeHidden.registerCustomHook('extension',
sendMessageUpdateArguments.bind(null, 'sendRequest'));
apiFunctions.setUpdateArgumentsPreValidate('sendMessage',
sendMessageUpdateArguments.bind(null, 'sendMessage'));
- apiFunctions.setUpdateArgumentsPreValidate('sendNativeMessage',
- sendMessageUpdateArguments.bind(null, 'sendNativeMessage'));
apiFunctions.setHandleRequest('sendRequest',
function(targetId, request, responseCallback) {
@@ -111,13 +108,6 @@ chromeHidden.registerCustomHook('extension',
chromeHidden.Port.sendMessageImpl(port, message, responseCallback);
});
- apiFunctions.setHandleRequest('sendNativeMessage',
- function(targetId, message, responseCallback) {
- var port = chrome.extension.connectNative(
- targetId, message, chromeHidden.kNativeMessageChannel);
- chromeHidden.Port.sendMessageImpl(port, '', responseCallback);
- });
-
apiFunctions.setUpdateArgumentsPreValidate('connect', function() {
// Align missing (optional) function arguments with the arguments that
// schema validation is expecting, e.g.
@@ -136,29 +126,10 @@ chromeHidden.registerCustomHook('extension',
connectInfo = arguments[nextArg++];
if (nextArg != arguments.length)
- throw new Error('Invalid arguments to connect.');
+ throw new Error('Invalid arguments to connect');
return [targetId, connectInfo];
});
- apiFunctions.setUpdateArgumentsPreValidate('connectNative', function() {
- var nextArg = 0;
-
- // appName is required.
- var appName = arguments[nextArg++];
-
- // connectionMessage is required.
- var connectMessage = arguments[nextArg++];
-
- // channelName is only passed by sendMessage
- var channelName = 'connectNative';
- if (typeof(arguments[nextArg]) == 'string')
- channelName = arguments[nextArg++];
-
- if (nextArg != arguments.length)
- throw new Error('Invalid arguments to connectNative.');
- return [appName, {name: channelName, message: connectMessage}];
- });
-
apiFunctions.setHandleRequest('connect', function(targetId, connectInfo) {
if (!targetId)
targetId = extensionId;
@@ -171,17 +142,4 @@ chromeHidden.registerCustomHook('extension',
return chromeHidden.Port.createPort(portId, name);
throw new Error('Error connecting to extension ' + targetId);
});
-
- apiFunctions.setHandleRequest('connectNative',
- function(nativeAppName, connectInfo) {
- // Turn the object into a string here, because it eventually will be.
- var portId = OpenChannelToNativeApp(extensionId,
- nativeAppName,
- connectInfo.name,
- JSON.stringify(connectInfo.message));
- if (portId >= 0) {
- return chromeHidden.Port.createPort(portId, connectInfo.name);
- }
- throw new Error('Error connecting to native app: ' + nativeAppName);
- });
});
diff --git a/chrome/renderer/resources/extensions/miscellaneous_bindings.js b/chrome/renderer/resources/extensions/miscellaneous_bindings.js
index e9d972d..d860bab 100644
--- a/chrome/renderer/resources/extensions/miscellaneous_bindings.js
+++ b/chrome/renderer/resources/extensions/miscellaneous_bindings.js
@@ -27,7 +27,6 @@
// Note: sendRequest is deprecated.
chromeHidden.kRequestChannel = "chrome.extension.sendRequest";
chromeHidden.kMessageChannel = "chrome.extension.sendMessage";
- chromeHidden.kNativeMessageChannel = "chrome.extension.sendNativeMessage";
// Map of port IDs to port object.
var ports = {};
@@ -258,10 +257,9 @@
// Shared implementation used by tabs.sendMessage and extension.sendMessage.
chromeHidden.Port.sendMessageImpl = function(port, request,
responseCallback) {
- if (port.name != chromeHidden.kNativeMessageChannel)
- port.postMessage(request);
+ port.postMessage(request);
- if (port.name != chromeHidden.kRequestChannel && !responseCallback) {
+ if (port.name == chromeHidden.kMessageChannel && !responseCallback) {
// TODO(mpcomplete): Do this for the old sendRequest API too, after
// verifying it doesn't break anything.
// Go ahead and disconnect immediately if the sender is not expecting