OLD | NEW |
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 privileged chrome extension related javascript APIs. | 5 // This script contains privileged chrome extension related javascript APIs. |
6 // It is loaded by pages whose URL has the chrome-extension protocol. | 6 // It is loaded by pages whose URL has the chrome-extension protocol. |
7 | 7 |
8 var chrome = chrome || {}; | 8 require('json_schema'); |
9 (function() { | 9 require('event_bindings'); |
10 native function GetChromeHidden(); | 10 var natives = requireNative('schema_generated_bindings'); |
11 native function GetExtensionAPIDefinition(); | 11 var GetExtensionAPIDefinition = natives.GetExtensionAPIDefinition; |
12 native function GetNextRequestId(); | 12 var GetNextRequestId = natives.GetNextRequestId; |
13 native function StartRequest(); | 13 var StartRequest = natives.StartRequest; |
14 native function SetIconCommon(); | 14 var SetIconCommon = natives.SetIconCommon; |
15 | 15 |
16 var chromeHidden = GetChromeHidden(); | 16 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
17 | 17 |
18 // The object to generate the bindings for "internal" APIs in, so that | 18 // The object to generate the bindings for "internal" APIs in, so that |
19 // extensions can't directly call them (without access to chromeHidden), | 19 // extensions can't directly call them (without access to chromeHidden), |
20 // but are still needed for internal mechanisms of extensions (e.g. events). | 20 // but are still needed for internal mechanisms of extensions (e.g. events). |
21 // | 21 // |
22 // This is distinct to the "*Private" APIs which are controlled via | 22 // This is distinct to the "*Private" APIs which are controlled via |
23 // having strict permissions and aren't generated *anywhere* unless needed. | 23 // having strict permissions and aren't generated *anywhere* unless needed. |
24 var internalAPIs = {}; | 24 var internalAPIs = {}; |
25 chromeHidden.internalAPIs = internalAPIs; | 25 chromeHidden.internalAPIs = internalAPIs; |
26 | 26 |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // beginInstallWithManifest2. | 746 // beginInstallWithManifest2. |
747 // See http://crbug.com/100242 | 747 // See http://crbug.com/100242 |
748 if (chrome.webstorePrivate) { | 748 if (chrome.webstorePrivate) { |
749 chrome.webstorePrivate.beginInstallWithManifest2 = | 749 chrome.webstorePrivate.beginInstallWithManifest2 = |
750 chrome.webstorePrivate.beginInstallWithManifest3; | 750 chrome.webstorePrivate.beginInstallWithManifest3; |
751 } | 751 } |
752 | 752 |
753 if (chrome.test) | 753 if (chrome.test) |
754 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; | 754 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; |
755 }); | 755 }); |
756 })(); | |
OLD | NEW |