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 // Event management for WebView. | 5 // Event management for WebView. |
6 | 6 |
7 var DeclarativeWebRequestSchema = | 7 var DeclarativeWebRequestSchema = |
8 requireNative('schema_registry').GetSchema('declarativeWebRequest'); | 8 requireNative('schema_registry').GetSchema('declarativeWebRequest'); |
9 var EventBindings = require('event_bindings'); | 9 var EventBindings = require('event_bindings'); |
10 var IdGenerator = requireNative('id_generator'); | 10 var IdGenerator = requireNative('id_generator'); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 var createDeclarativeWebRequestEvent = function(webRequestEvent) { | 223 var createDeclarativeWebRequestEvent = function(webRequestEvent) { |
224 return function() { | 224 return function() { |
225 if (!this[webRequestEvent.name]) { | 225 if (!this[webRequestEvent.name]) { |
226 // The onMessage event gets a special event type because we want | 226 // The onMessage event gets a special event type because we want |
227 // the listener to fire only for messages targeted for this particular | 227 // the listener to fire only for messages targeted for this particular |
228 // <webview>. | 228 // <webview>. |
229 var EventClass = webRequestEvent.name === 'onMessage' ? | 229 var EventClass = webRequestEvent.name === 'onMessage' ? |
230 DeclarativeWebRequestEvent : EventBindings.Event; | 230 DeclarativeWebRequestEvent : EventBindings.Event; |
231 this[webRequestEvent.name] = | 231 this[webRequestEvent.name] = |
232 new EventClass( | 232 new EventClass( |
233 'webViewInternal.' + webRequestEvent.name, | 233 'declarativeWebRequest.' + webRequestEvent.name, |
234 webRequestEvent.parameters, | 234 webRequestEvent.parameters, |
235 webRequestEvent.options, | 235 webRequestEvent.options, |
236 this.viewInstanceId); | 236 this.viewInstanceId); |
237 } | 237 } |
238 return this[webRequestEvent.name]; | 238 return this[webRequestEvent.name]; |
239 }.bind(this); | 239 }.bind(this); |
240 }.bind(this); | 240 }.bind(this); |
241 | 241 |
242 for (var i = 0; i < DeclarativeWebRequestSchema.events.length; ++i) { | 242 for (var i = 0; i < DeclarativeWebRequestSchema.events.length; ++i) { |
243 var eventSchema = DeclarativeWebRequestSchema.events[i]; | 243 var eventSchema = DeclarativeWebRequestSchema.events[i]; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } | 590 } |
591 }; | 591 }; |
592 | 592 |
593 WebViewEvents.prototype.handleSizeChangedEvent = function( | 593 WebViewEvents.prototype.handleSizeChangedEvent = function( |
594 event, webViewEvent) { | 594 event, webViewEvent) { |
595 this.webViewImpl.onSizeChanged(webViewEvent); | 595 this.webViewImpl.onSizeChanged(webViewEvent); |
596 }; | 596 }; |
597 | 597 |
598 exports.WebViewEvents = WebViewEvents; | 598 exports.WebViewEvents = WebViewEvents; |
599 exports.CreateEvent = CreateEvent; | 599 exports.CreateEvent = CreateEvent; |
OLD | NEW |