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

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

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 // This script contains unprivileged javascript APIs related to chrome 5 // This script contains unprivileged javascript APIs related to chrome
6 // extensions. It is loaded by any extension-related context, such as content 6 // extensions. It is loaded by any extension-related context, such as content
7 // scripts or background pages. 7 // scripts or background pages.
8 // See user_script_slave.cc for script that is loaded by content scripts only. 8 // See user_script_slave.cc for script that is loaded by content scripts only.
9 // TODO(mpcomplete): we also load this in regular web pages, but don't need to. 9 // TODO(mpcomplete): we also load this in regular web pages, but don't need to.
10 10
11 var chrome = chrome || {}; 11 var OpenChannelToExtension = natives.OpenChannelToExtension;
12 (function () { 12 var CloseChannel = natives.CloseChannel;
13 native function OpenChannelToExtension(sourceId, targetId, name); 13 var PortAddRef = natives.PortAddRef;
14 native function CloseChannel(portId, notifyBrowser); 14 var PortRelease = natives.PortRelease;
15 native function PortAddRef(portId); 15 var PostMessage = natives.PostMessage;
16 native function PortRelease(portId); 16 var GetChromeHidden = natives.GetChromeHidden;
17 native function PostMessage(portId, msg); 17 var GetL10nMessage = natives.GetL10nMessage;
18 native function GetChromeHidden(); 18 var Print = natives.Print;
19 native function GetL10nMessage();
20 native function Print();
21 19
22 var chromeHidden = GetChromeHidden(); 20 var chromeHidden = GetChromeHidden();
23 var manifestVersion; 21 var manifestVersion;
24 22
25 // The reserved channel name for the sendRequest API. 23 // The reserved channel name for the sendRequest API.
26 chromeHidden.kRequestChannel = "chrome.extension.sendRequest"; 24 chromeHidden.kRequestChannel = "chrome.extension.sendRequest";
27 25
28 // Map of port IDs to port object. 26 // Map of port IDs to port object.
29 var ports = {}; 27 var ports = {};
30 28
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 if (!path.length || path[0] != "/") 280 if (!path.length || path[0] != "/")
283 path = "/" + path; 281 path = "/" + path;
284 return "chrome-extension://" + extensionId + path; 282 return "chrome-extension://" + extensionId + path;
285 }; 283 };
286 284
287 chrome.i18n = chrome.i18n || {}; 285 chrome.i18n = chrome.i18n || {};
288 chrome.i18n.getMessage = function(message_name, placeholders) { 286 chrome.i18n.getMessage = function(message_name, placeholders) {
289 return GetL10nMessage(message_name, placeholders, extensionId); 287 return GetL10nMessage(message_name, placeholders, extensionId);
290 }; 288 };
291 }); 289 });
292
293 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698