| 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 var chrome = chrome || {}; |
| 9 (function() { | 9 (function() { |
| 10 native function GetChromeHidden(); | 10 native function GetChromeHidden(); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 var constructor = customTypes[property["$ref"]]; | 486 var constructor = customTypes[property["$ref"]]; |
| 487 if (!constructor) | 487 if (!constructor) |
| 488 throw new Error("No custom binding for " + property["$ref"]); | 488 throw new Error("No custom binding for " + property["$ref"]); |
| 489 var args = value; | 489 var args = value; |
| 490 // For an object property, |value| is an array of constructor | 490 // For an object property, |value| is an array of constructor |
| 491 // arguments, but we want to pass the arguments directly | 491 // arguments, but we want to pass the arguments directly |
| 492 // (i.e. not as an array), so we have to fake calling |new| on | 492 // (i.e. not as an array), so we have to fake calling |new| on |
| 493 // the constructor. | 493 // the constructor. |
| 494 value = { __proto__: constructor.prototype }; | 494 value = { __proto__: constructor.prototype }; |
| 495 constructor.apply(value, args); | 495 constructor.apply(value, args); |
| 496 // Recursively add properties. |
| 497 addProperties(value, property); |
| 496 } else if (property.type === 'object') { | 498 } else if (property.type === 'object') { |
| 497 // Recursively add properties. | 499 // Recursively add properties. |
| 498 addProperties(value, property); | 500 addProperties(value, property); |
| 499 } else if (property.type !== 'string') { | 501 } else if (property.type !== 'string') { |
| 500 throw "NOT IMPLEMENTED (extension_api.json error): Cannot " + | 502 throw "NOT IMPLEMENTED (extension_api.json error): Cannot " + |
| 501 "parse values for type \"" + property.type + "\""; | 503 "parse values for type \"" + property.type + "\""; |
| 502 } | 504 } |
| 503 } | 505 } |
| 504 if (value) { | 506 if (value) { |
| 505 m[prop] = value; | 507 m[prop] = value; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 // See http://crbug.com/100242 | 548 // See http://crbug.com/100242 |
| 547 if (apiExists("webstorePrivate")) { | 549 if (apiExists("webstorePrivate")) { |
| 548 chrome.webstorePrivate.beginInstallWithManifest2 = | 550 chrome.webstorePrivate.beginInstallWithManifest2 = |
| 549 chrome.webstorePrivate.beginInstallWithManifest3; | 551 chrome.webstorePrivate.beginInstallWithManifest3; |
| 550 } | 552 } |
| 551 | 553 |
| 552 if (apiExists("test")) | 554 if (apiExists("test")) |
| 553 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; | 555 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; |
| 554 }); | 556 }); |
| 555 })(); | 557 })(); |
| OLD | NEW |