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

Side by Side Diff: chrome/renderer/resources/extensions/experimental.declarative_custom_bindings.js

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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 // Custom bindings for the declarative API. 5 // Custom bindings for the declarative API.
6 6
7 (function() { 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
8
9 native function GetChromeHidden();
10
11 var chromeHidden = GetChromeHidden();
12 8
13 chromeHidden.registerCustomHook('experimental.declarative', 9 chromeHidden.registerCustomHook('experimental.declarative',
14 function(bindingsAPI) { 10 function(bindingsAPI) {
15 var apiFunctions = bindingsAPI.apiFunctions; 11 var apiFunctions = bindingsAPI.apiFunctions;
16 var sendRequest = bindingsAPI.sendRequest; 12 var sendRequest = bindingsAPI.sendRequest;
17 var apiDefinitions = bindingsAPI.apiDefinitions; 13 var apiDefinitions = bindingsAPI.apiDefinitions;
18 var cachedEventOptions = {}; 14 var cachedEventOptions = {};
19 15
20 function getEventOptions(qualifiedEventName) { 16 function getEventOptions(qualifiedEventName) {
21 if (cachedEventOptions[qualifiedEventName]) 17 if (cachedEventOptions[qualifiedEventName])
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 throw new Error('Event ' + eventName + ' misses conditions or ' + 67 throw new Error('Event ' + eventName + ' misses conditions or ' +
72 'actions in the API specification.'); 68 'actions in the API specification.');
73 } 69 }
74 validateRules(rules, 70 validateRules(rules,
75 eventOptions.conditions, 71 eventOptions.conditions,
76 eventOptions.actions); 72 eventOptions.actions);
77 sendRequest(this.name, [eventName, rules, opt_callback], 73 sendRequest(this.name, [eventName, rules, opt_callback],
78 this.definition.parameters); 74 this.definition.parameters);
79 }); 75 });
80 }); 76 });
81
82 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698