OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 9 // TODO(mpcomplete): we also load this in regular web pages, but don't need |
10 // to. | 10 // to. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 // Sets up stubs to throw a better error message for the common case of | 235 // Sets up stubs to throw a better error message for the common case of |
236 // developers trying to call extension API's that aren't allowed to be | 236 // developers trying to call extension API's that aren't allowed to be |
237 // called from content scripts. | 237 // called from content scripts. |
238 function setupApiStubs() { | 238 function setupApiStubs() { |
239 // TODO(asargent) It would be nice to eventually generate this | 239 // TODO(asargent) It would be nice to eventually generate this |
240 // programmatically from extension_api.json (there is already a browser test | 240 // programmatically from extension_api.json (there is already a browser test |
241 // that should prevent it from getting stale). | 241 // that should prevent it from getting stale). |
242 var privileged = [ | 242 var privileged = [ |
243 // Entire namespaces. | 243 // Entire namespaces. |
244 "bookmarks", "browserAction", "devtools", "experimental.bookmarkManager", | 244 "bookmarks", |
245 "experimental.extension", "experimental.history", "experimental.popup", | 245 "browserAction", |
246 "experimental.processes", "pageAction", "pageActions", "tabs", "test", | 246 "devtools", |
247 "toolstrip", "windows", | 247 "experimental.accessibility", |
| 248 "experimental.bookmarkManager", |
| 249 "experimental.extension", |
| 250 "experimental.history", |
| 251 "experimental.popup", |
| 252 "experimental.processes", |
| 253 "pageAction", |
| 254 "pageActions", |
| 255 "tabs", |
| 256 "test", |
| 257 "toolstrip", |
| 258 "windows", |
248 | 259 |
249 // Functions/events/properties within the extension namespace. | 260 // Functions/events/properties within the extension namespace. |
250 "extension.getBackgroundPage", "extension.getExtensionTabs", | 261 "extension.getBackgroundPage", |
251 "extension.getToolstrips", "extension.getViews", "extension.lastError", | 262 "extension.getExtensionTabs", |
252 "extension.onConnectExternal", "extension.onRequestExternal", | 263 "extension.getToolstrips", |
| 264 "extension.getViews", |
| 265 "extension.lastError", |
| 266 "extension.onConnectExternal", |
| 267 "extension.onRequestExternal", |
253 "i18n.getAcceptLanguages" | 268 "i18n.getAcceptLanguages" |
254 ]; | 269 ]; |
255 for (var i = 0; i < privileged.length; i++) { | 270 for (var i = 0; i < privileged.length; i++) { |
256 createStub(privileged[i]); | 271 createStub(privileged[i]); |
257 } | 272 } |
258 } | 273 } |
259 | 274 |
260 })(); | 275 })(); |
OLD | NEW |