OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 var Event = require('event_bindings').Event; | 5 var Event = require('event_bindings').Event; |
6 var forEach = require('utils').forEach; | 6 var forEach = require('utils').forEach; |
7 var GetAvailability = requireNative('v8_context').GetAvailability; | 7 var GetAvailability = requireNative('v8_context').GetAvailability; |
8 var exceptionHandler = require('uncaught_exception_handler'); | 8 var exceptionHandler = require('uncaught_exception_handler'); |
9 var lastError = require('lastError'); | 9 var lastError = require('lastError'); |
10 var logActivity = requireNative('activityLogger'); | 10 var logActivity = requireNative('activityLogger'); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 customType.prototype = new CustomBindingsObject(); | 172 customType.prototype = new CustomBindingsObject(); |
173 customType.prototype.setSchema(type); | 173 customType.prototype.setSchema(type); |
174 return customType; | 174 return customType; |
175 } | 175 } |
176 | 176 |
177 var platform = getPlatform(); | 177 var platform = getPlatform(); |
178 | 178 |
179 function Binding(apiName) { | 179 function Binding(apiName) { |
180 this.apiName_ = apiName; | 180 this.apiName_ = apiName; |
181 this.apiFunctions_ = new APIFunctions(apiName); | 181 this.apiFunctions_ = new APIFunctions(apiName); |
182 this.customEvent_ = null; | |
183 this.customHooks_ = []; | 182 this.customHooks_ = []; |
184 }; | 183 }; |
185 | 184 |
186 Binding.create = function(apiName) { | 185 Binding.create = function(apiName) { |
187 return new Binding(apiName); | 186 return new Binding(apiName); |
188 }; | 187 }; |
189 | 188 |
190 Binding.prototype = { | 189 Binding.prototype = { |
| 190 // Sneaky workaround for Object.prototype getters/setters - our prototype |
| 191 // isn't Object.prototype. SafeBuiltins (e.g. $Object.hasOwnProperty()) |
| 192 // should still work. |
| 193 __proto__: null, |
| 194 |
| 195 // Forward-declare properties. |
| 196 apiName_: undefined, |
| 197 apiFunctions_: undefined, |
| 198 customEvent_: undefined, |
| 199 customHooks_: undefined, |
| 200 |
191 // The API through which the ${api_name}_custom_bindings.js files customize | 201 // The API through which the ${api_name}_custom_bindings.js files customize |
192 // their API bindings beyond what can be generated. | 202 // their API bindings beyond what can be generated. |
193 // | 203 // |
194 // There are 2 types of customizations available: those which are required in | 204 // There are 2 types of customizations available: those which are required in |
195 // order to do the schema generation (registerCustomEvent and | 205 // order to do the schema generation (registerCustomEvent and |
196 // registerCustomType), and those which can only run after the bindings have | 206 // registerCustomType), and those which can only run after the bindings have |
197 // been generated (registerCustomHook). | 207 // been generated (registerCustomHook). |
198 | 208 |
199 // Registers a custom event type for the API identified by |namespace|. | 209 // Registers a custom event type for the API identified by |namespace|. |
200 // |event| is the event's constructor. | 210 // |event| is the event's constructor. |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 availability.message); | 549 availability.message); |
540 return; | 550 return; |
541 } | 551 } |
542 | 552 |
543 this.runHooks_(mod, schema); | 553 this.runHooks_(mod, schema); |
544 return mod; | 554 return mod; |
545 } | 555 } |
546 }; | 556 }; |
547 | 557 |
548 exports.$set('Binding', Binding); | 558 exports.$set('Binding', Binding); |
OLD | NEW |