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

Unified Diff: chrome/renderer/resources/extensions/runtime_custom_bindings.js

Issue 11968028: Remove connect message from Native Messaging API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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/resources/extensions/runtime_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/runtime_custom_bindings.js b/chrome/renderer/resources/extensions/runtime_custom_bindings.js
index c5e63ac1fa50aad9a6a1d5149e145a8353bdb33a..a4db2a7e86e1b5610d837ccb533838fdd7f74679 100644
--- a/chrome/renderer/resources/extensions/runtime_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/runtime_custom_bindings.js
@@ -47,9 +47,8 @@ chromeHidden.registerCustomHook('runtime', function(bindings, id, contextType) {
apiFunctions.setHandleRequest('sendNativeMessage',
function(targetId, message, responseCallback) {
- var port = chrome.runtime.connectNative(
- targetId, message, chromeHidden.kNativeMessageChannel);
- chromeHidden.Port.sendMessageImpl(port, '', responseCallback);
+ var port = chrome.runtime.connectNative(targetId);
+ chromeHidden.Port.sendMessageImpl(port, message, responseCallback);
});
apiFunctions.setUpdateArgumentsPreValidate('connect', function() {
@@ -74,23 +73,12 @@ chromeHidden.registerCustomHook('runtime', function(bindings, id, contextType) {
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)
+ apiFunctions.setUpdateArgumentsPreValidate('connectNative',
+ function(appName) {
+ if (typeof(appName) !== 'string') {
throw new Error('Invalid arguments to connectNative.');
- return [appName, {name: channelName, message: connectMessage}];
+ }
+ return [appName];
});
apiFunctions.setHandleRequest('connect', function(targetId, connectInfo) {
@@ -113,14 +101,11 @@ chromeHidden.registerCustomHook('runtime', function(bindings, id, contextType) {
return;
apiFunctions.setHandleRequest('connectNative',
- function(nativeAppName, connectInfo) {
+ function(nativeAppName) {
// Turn the object into a string here, because it eventually will be.
- var portId = OpenChannelToNativeApp(chrome.runtime.id,
- nativeAppName,
- connectInfo.name,
- JSON.stringify(connectInfo.message));
+ var portId = OpenChannelToNativeApp(chrome.runtime.id, nativeAppName);
if (portId >= 0) {
- return chromeHidden.Port.createPort(portId, connectInfo.name);
+ return chromeHidden.Port.createPort(portId, '');
}
throw new Error('Error connecting to native app: ' + nativeAppName);
});

Powered by Google App Engine
This is Rietveld 408576698