Chromium Code Reviews| 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 require('json_schema'); | 8 require('json_schema'); |
| 9 require('event_bindings'); | 9 require('event_bindings'); |
| 10 var natives = requireNative('schema_generated_bindings'); | 10 var natives = requireNative('schema_generated_bindings'); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 | 524 |
| 525 // Read api definitions and setup api functions in the chrome namespace. | 525 // Read api definitions and setup api functions in the chrome namespace. |
| 526 // TODO(rafaelw): Consider defining a json schema for an api definition | 526 // TODO(rafaelw): Consider defining a json schema for an api definition |
| 527 // and validating either here, in a unit_test or both. | 527 // and validating either here, in a unit_test or both. |
| 528 // TODO(rafaelw): Handle synchronous functions. | 528 // TODO(rafaelw): Handle synchronous functions. |
| 529 // TODO(rafaelw): Consider providing some convenient override points | 529 // TODO(rafaelw): Consider providing some convenient override points |
| 530 // for api functions that wish to insert themselves into the call. | 530 // for api functions that wish to insert themselves into the call. |
| 531 var platform = getPlatform(); | 531 var platform = getPlatform(); |
| 532 | 532 |
| 533 apiDefinitions.forEach(function(apiDef) { | 533 apiDefinitions.forEach(function(apiDef) { |
| 534 // TODO(kalman): Remove this, or refactor schema_generated_bindings.js so | |
| 535 // that it isn't necessary. For now, chrome.app is entirely handwritten. | |
| 536 if (apiDef.namespace === 'app') | |
| 537 return; | |
|
not at google - send to devlin
2012/03/20 03:32:13
sigh...
| |
| 538 | |
| 534 if (!isSchemaNodeSupported(apiDef, platform, manifestVersion)) | 539 if (!isSchemaNodeSupported(apiDef, platform, manifestVersion)) |
| 535 return; | 540 return; |
| 536 | 541 |
| 537 // See comment on internalAPIs at the top. | 542 // See comment on internalAPIs at the top. |
| 538 var mod = apiDef.internal ? internalAPIs : chrome; | 543 var mod = apiDef.internal ? internalAPIs : chrome; |
| 539 | 544 |
| 540 var namespaces = apiDef.namespace.split('.'); | 545 var namespaces = apiDef.namespace.split('.'); |
| 541 for (var index = 0, name; name = namespaces[index]; index++) { | 546 for (var index = 0, name; name = namespaces[index]; index++) { |
| 542 mod[name] = mod[name] || {}; | 547 mod[name] = mod[name] || {}; |
| 543 mod = mod[name]; | 548 mod = mod[name]; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 746 // beginInstallWithManifest2. | 751 // beginInstallWithManifest2. |
| 747 // See http://crbug.com/100242 | 752 // See http://crbug.com/100242 |
| 748 if (chrome.webstorePrivate) { | 753 if (chrome.webstorePrivate) { |
| 749 chrome.webstorePrivate.beginInstallWithManifest2 = | 754 chrome.webstorePrivate.beginInstallWithManifest2 = |
| 750 chrome.webstorePrivate.beginInstallWithManifest3; | 755 chrome.webstorePrivate.beginInstallWithManifest3; |
| 751 } | 756 } |
| 752 | 757 |
| 753 if (chrome.test) | 758 if (chrome.test) |
| 754 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; | 759 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; |
| 755 }); | 760 }); |
| OLD | NEW |