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

Side by Side Diff: chrome/renderer/resources/extensions/runtime_custom_bindings.js

Issue 11745015: Update references to the extension messaging APIs to point to the "runtime" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Custom bindings for the runtime API. 5 // Custom bindings for the runtime API.
6 6
7 var runtimeNatives = requireNative('runtime'); 7 var runtimeNatives = requireNative('runtime');
8 var extensionNatives = requireNative('extension'); 8 var extensionNatives = requireNative('extension');
9 var GetExtensionViews = extensionNatives.GetExtensionViews; 9 var GetExtensionViews = extensionNatives.GetExtensionViews;
10 var OpenChannelToExtension = runtimeNatives.OpenChannelToExtension; 10 var OpenChannelToExtension = runtimeNatives.OpenChannelToExtension;
(...skipping 29 matching lines...) Expand all
40 40
41 apiFunctions.setHandleRequest('sendMessage', 41 apiFunctions.setHandleRequest('sendMessage',
42 function(targetId, message, responseCallback) { 42 function(targetId, message, responseCallback) {
43 var port = chrome.runtime.connect(targetId || chrome.runtime.id, 43 var port = chrome.runtime.connect(targetId || chrome.runtime.id,
44 {name: chromeHidden.kMessageChannel}); 44 {name: chromeHidden.kMessageChannel});
45 chromeHidden.Port.sendMessageImpl(port, message, responseCallback); 45 chromeHidden.Port.sendMessageImpl(port, message, responseCallback);
46 }); 46 });
47 47
48 apiFunctions.setHandleRequest('sendNativeMessage', 48 apiFunctions.setHandleRequest('sendNativeMessage',
49 function(targetId, message, responseCallback) { 49 function(targetId, message, responseCallback) {
50 var port = chrome.extension.connectNative( 50 var port = chrome.runtime.connectNative(
51 targetId, message, chromeHidden.kNativeMessageChannel); 51 targetId, message, chromeHidden.kNativeMessageChannel);
52 chromeHidden.Port.sendMessageImpl(port, '', responseCallback); 52 chromeHidden.Port.sendMessageImpl(port, '', responseCallback);
53 }); 53 });
54 54
55 apiFunctions.setUpdateArgumentsPreValidate('connect', function() { 55 apiFunctions.setUpdateArgumentsPreValidate('connect', function() {
56 // Align missing (optional) function arguments with the arguments that 56 // Align missing (optional) function arguments with the arguments that
57 // schema validation is expecting, e.g. 57 // schema validation is expecting, e.g.
58 // runtime.connect() -> runtime.connect(null, null) 58 // runtime.connect() -> runtime.connect(null, null)
59 // runtime.connect({}) -> runtime.connect(null, {}) 59 // runtime.connect({}) -> runtime.connect(null, {})
60 var nextArg = 0; 60 var nextArg = 0;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 apiFunctions.setCustomCallback('getBackgroundPage', 128 apiFunctions.setCustomCallback('getBackgroundPage',
129 function(name, request, response) { 129 function(name, request, response) {
130 if (request.callback) { 130 if (request.callback) {
131 var bg = GetExtensionViews(-1, 'BACKGROUND')[0] || null; 131 var bg = GetExtensionViews(-1, 'BACKGROUND')[0] || null;
132 request.callback(bg); 132 request.callback(bg);
133 } 133 }
134 request.callback = null; 134 request.callback = null;
135 }); 135 });
136 136
137 }); 137 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698