| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 448 |
| 449 // Setup Events | 449 // Setup Events |
| 450 if (apiDef.events) { | 450 if (apiDef.events) { |
| 451 apiDef.events.forEach(function(eventDef) { | 451 apiDef.events.forEach(function(eventDef) { |
| 452 if (eventDef.name in module || | 452 if (eventDef.name in module || |
| 453 addUnprivilegedAccessGetter(module, eventDef.name, | 453 addUnprivilegedAccessGetter(module, eventDef.name, |
| 454 eventDef.unprivileged)) { | 454 eventDef.unprivileged)) { |
| 455 return; | 455 return; |
| 456 } | 456 } |
| 457 | 457 |
| 458 var typesAPI = { |
| 459 'sendRequest': sendRequest, |
| 460 'apiDefinitions': apiDefinitions |
| 461 }; |
| 458 var eventName = apiDef.namespace + "." + eventDef.name; | 462 var eventName = apiDef.namespace + "." + eventDef.name; |
| 459 var customEvent = customEvents[apiDef.namespace]; | 463 var customEvent = customEvents[apiDef.namespace]; |
| 460 if (customEvent) { | 464 if (customEvent) { |
| 461 module[eventDef.name] = new customEvent( | 465 module[eventDef.name] = new customEvent( |
| 462 eventName, eventDef.parameters, eventDef.extraParameters); | 466 eventName, eventDef.parameters, eventDef.extraParameters, |
| 467 eventDef.options, typesAPI); |
| 463 } else { | 468 } else { |
| 464 module[eventDef.name] = new chrome.Event( | 469 module[eventDef.name] = new chrome.Event( |
| 465 eventName, eventDef.parameters); | 470 eventName, eventDef.parameters, eventDef.options, typesAPI); |
| 466 } | 471 } |
| 467 }); | 472 }); |
| 468 } | 473 } |
| 469 | 474 |
| 470 function addProperties(m, def) { | 475 function addProperties(m, def) { |
| 471 // Parse any values defined for properties. | 476 // Parse any values defined for properties. |
| 472 if (def.properties) { | 477 if (def.properties) { |
| 473 forEach(def.properties, function(prop, property) { | 478 forEach(def.properties, function(prop, property) { |
| 474 if (prop in m || | 479 if (prop in m || |
| 475 addUnprivilegedAccessGetter(m, prop, property.unprivileged)) { | 480 addUnprivilegedAccessGetter(m, prop, property.unprivileged)) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 // See http://crbug.com/100242 | 551 // See http://crbug.com/100242 |
| 547 if (apiExists("webstorePrivate")) { | 552 if (apiExists("webstorePrivate")) { |
| 548 chrome.webstorePrivate.beginInstallWithManifest2 = | 553 chrome.webstorePrivate.beginInstallWithManifest2 = |
| 549 chrome.webstorePrivate.beginInstallWithManifest3; | 554 chrome.webstorePrivate.beginInstallWithManifest3; |
| 550 } | 555 } |
| 551 | 556 |
| 552 if (apiExists("test")) | 557 if (apiExists("test")) |
| 553 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; | 558 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; |
| 554 }); | 559 }); |
| 555 })(); | 560 })(); |
| OLD | NEW |