OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 toolstrips. | 7 // scripts or toolstrips. |
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 chrome = chrome || {}; |
12 (function () { | 12 (function () { |
13 native function OpenChannelToExtension(sourceId, targetId, name); | 13 native function OpenChannelToExtension(sourceId, targetId, name); |
14 native function CloseChannel(portId, notifyBrowser); | 14 native function CloseChannel(portId, notifyBrowser); |
15 native function PortAddRef(portId); | 15 native function PortAddRef(portId); |
16 native function PortRelease(portId); | 16 native function PortRelease(portId); |
17 native function PostMessage(portId, msg); | 17 native function PostMessage(portId, msg); |
18 native function GetChromeHidden(); | 18 native function GetChromeHidden(); |
19 native function GetL10nMessage(); | 19 native function GetL10nMessage(); |
| 20 native function Print(); |
20 | 21 |
21 var chromeHidden = GetChromeHidden(); | 22 var chromeHidden = GetChromeHidden(); |
22 | 23 |
23 // The reserved channel name for the sendRequest API. | 24 // The reserved channel name for the sendRequest API. |
24 chromeHidden.kRequestChannel = "chrome.extension.sendRequest"; | 25 chromeHidden.kRequestChannel = "chrome.extension.sendRequest"; |
25 | 26 |
26 // Map of port IDs to port object. | 27 // Map of port IDs to port object. |
27 var ports = {}; | 28 var ports = {}; |
28 | 29 |
29 // Map of port IDs to chromeHidden.onUnload listeners. Keep track of these | 30 // Map of port IDs to chromeHidden.onUnload listeners. Keep track of these |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 "extension.onRequestExternal", | 352 "extension.onRequestExternal", |
352 "extension.setUpdateUrlData", | 353 "extension.setUpdateUrlData", |
353 "i18n.getAcceptLanguages" | 354 "i18n.getAcceptLanguages" |
354 ]; | 355 ]; |
355 for (var i = 0; i < privileged.length; i++) { | 356 for (var i = 0; i < privileged.length; i++) { |
356 createStub(privileged[i]); | 357 createStub(privileged[i]); |
357 } | 358 } |
358 } | 359 } |
359 | 360 |
360 })(); | 361 })(); |
OLD | NEW |