Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: chrome/renderer/resources/extensions/schema_generated_bindings.js

Issue 9192029: Bindings layer for declarative events API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check whether eventName may be optional Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 if (eventDef.name in module || 476 if (eventDef.name in module ||
477 addUnprivilegedAccessGetter(module, eventDef.name, 477 addUnprivilegedAccessGetter(module, eventDef.name,
478 eventDef.unprivileged)) { 478 eventDef.unprivileged)) {
479 return; 479 return;
480 } 480 }
481 481
482 var eventName = apiDef.namespace + "." + eventDef.name; 482 var eventName = apiDef.namespace + "." + eventDef.name;
483 var customEvent = customEvents[apiDef.namespace]; 483 var customEvent = customEvents[apiDef.namespace];
484 if (customEvent) { 484 if (customEvent) {
485 module[eventDef.name] = new customEvent( 485 module[eventDef.name] = new customEvent(
486 eventName, eventDef.parameters, eventDef.extraParameters); 486 eventName, eventDef.parameters, eventDef.extraParameters,
487 eventDef.options);
487 } else { 488 } else {
488 module[eventDef.name] = new chrome.Event( 489 module[eventDef.name] = new chrome.Event(
489 eventName, eventDef.parameters); 490 eventName, eventDef.parameters, eventDef.options);
490 } 491 }
491 }); 492 });
492 } 493 }
493 494
494 function addProperties(m, def) { 495 function addProperties(m, def) {
495 // Parse any values defined for properties. 496 // Parse any values defined for properties.
496 if (def.properties) { 497 if (def.properties) {
497 forEach(def.properties, function(prop, property) { 498 forEach(def.properties, function(prop, property) {
498 if (!isSchemaNodeSupported(property, platform, manifestVersion)) 499 if (!isSchemaNodeSupported(property, platform, manifestVersion))
499 return; 500 return;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 if (!hook) 560 if (!hook)
560 return; 561 return;
561 562
562 // Pass through the public API of schema_generated_bindings, to be used 563 // Pass through the public API of schema_generated_bindings, to be used
563 // by custom bindings JS files. Create a new one so that bindings can't 564 // by custom bindings JS files. Create a new one so that bindings can't
564 // interfere with each other. 565 // interfere with each other.
565 hook({ 566 hook({
566 apiFunctions: apiFunctions, 567 apiFunctions: apiFunctions,
567 sendRequest: sendRequest, 568 sendRequest: sendRequest,
568 setIcon: setIcon, 569 setIcon: setIcon,
570 apiDefinitions: apiDefinitions,
569 }, extensionId); 571 }, extensionId);
570 }); 572 });
571 573
572 // TOOD(mihaip): remove this alias once the webstore stops calling 574 // TOOD(mihaip): remove this alias once the webstore stops calling
573 // beginInstallWithManifest2. 575 // beginInstallWithManifest2.
574 // See http://crbug.com/100242 576 // See http://crbug.com/100242
575 if (apiExists("webstorePrivate")) { 577 if (apiExists("webstorePrivate")) {
576 chrome.webstorePrivate.beginInstallWithManifest2 = 578 chrome.webstorePrivate.beginInstallWithManifest2 =
577 chrome.webstorePrivate.beginInstallWithManifest3; 579 chrome.webstorePrivate.beginInstallWithManifest3;
578 } 580 }
579 581
580 if (apiExists("test")) 582 if (apiExists("test"))
581 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; 583 chrome.test.getApiDefinitions = GetExtensionAPIDefinition;
582 }); 584 });
583 })(); 585 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698