| 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 // Custom bindings for the declarative API. | 5 // Custom bindings for the declarative API. |
| 6 | 6 |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 7 (function() { |
| 8 |
| 9 native function GetChromeHidden(); |
| 10 |
| 11 var chromeHidden = GetChromeHidden(); |
| 8 | 12 |
| 9 chromeHidden.registerCustomHook('experimental.declarative', | 13 chromeHidden.registerCustomHook('experimental.declarative', |
| 10 function(bindingsAPI) { | 14 function(bindingsAPI) { |
| 11 var apiFunctions = bindingsAPI.apiFunctions; | 15 var apiFunctions = bindingsAPI.apiFunctions; |
| 12 var sendRequest = bindingsAPI.sendRequest; | 16 var sendRequest = bindingsAPI.sendRequest; |
| 13 var apiDefinitions = bindingsAPI.apiDefinitions; | 17 var apiDefinitions = bindingsAPI.apiDefinitions; |
| 14 var cachedEventOptions = {}; | 18 var cachedEventOptions = {}; |
| 15 | 19 |
| 16 function getEventOptions(qualifiedEventName) { | 20 function getEventOptions(qualifiedEventName) { |
| 17 if (cachedEventOptions[qualifiedEventName]) | 21 if (cachedEventOptions[qualifiedEventName]) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 throw new Error('Event ' + eventName + ' misses conditions or ' + | 71 throw new Error('Event ' + eventName + ' misses conditions or ' + |
| 68 'actions in the API specification.'); | 72 'actions in the API specification.'); |
| 69 } | 73 } |
| 70 validateRules(rules, | 74 validateRules(rules, |
| 71 eventOptions.conditions, | 75 eventOptions.conditions, |
| 72 eventOptions.actions); | 76 eventOptions.actions); |
| 73 sendRequest(this.name, [eventName, rules, opt_callback], | 77 sendRequest(this.name, [eventName, rules, opt_callback], |
| 74 this.definition.parameters); | 78 this.definition.parameters); |
| 75 }); | 79 }); |
| 76 }); | 80 }); |
| 81 |
| 82 })(); |
| OLD | NEW |