Chromium Code Reviews| 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 CreateEvent = require('guestViewEvents').CreateEvent; | 7 var CreateEvent = require('guestViewEvents').CreateEvent; |
| 8 var DeclarativeWebRequestSchema = | 8 var DeclarativeWebRequestSchema = |
| 9 requireNative('schema_registry').GetSchema('declarativeWebRequest'); | 9 requireNative('schema_registry').GetSchema('declarativeWebRequest'); |
| 10 var GuestViewEvents = require('guestViewEvents').GuestViewEvents; | 10 var GuestViewEvents = require('guestViewEvents').GuestViewEvents; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 return bindingUtil.createCustomDeclarativeEvent( | 31 return bindingUtil.createCustomDeclarativeEvent( |
| 32 name, options.actions, options.conditions, webviewId || 0); | 32 name, options.actions, options.conditions, webviewId || 0); |
| 33 } | 33 } |
| 34 if (!jsEvent) | 34 if (!jsEvent) |
| 35 jsEvent = require('event_bindings').Event; | 35 jsEvent = require('event_bindings').Event; |
| 36 return new jsEvent(name, schema, options, webviewId); | 36 return new jsEvent(name, schema, options, webviewId); |
| 37 } | 37 } |
| 38 | 38 |
| 39 function createCustomEvent(name, schema, options) { | 39 function createCustomEvent(name, schema, options) { |
| 40 if (bindingUtil) | 40 if (bindingUtil) |
| 41 return bindingUtil.createCustomEvent(name, undefined, false); | 41 return bindingUtil.createCustomEvent(name, undefined, false, false); |
| 42 if (!jsEvent) | 42 if (!jsEvent) |
| 43 jsEvent = require('event_bindings').Event; | 43 jsEvent = require('event_bindings').Event; |
| 44 return new jsEvent(name, schema, options); | 44 return new jsEvent(name, schema, options); |
|
lazyboy
2017/07/14 00:04:42
Can we DCHECK options.supportsLazyEvents == false?
Devlin
2017/07/14 15:37:54
Good idea; done.
| |
| 45 } | 45 } |
| 46 | 46 |
| 47 function createOnMessageEvent(name, schema, options, webviewId) { | 47 function createOnMessageEvent(name, schema, options, webviewId) { |
| 48 var subEventName = name + '/' + IdGenerator.GetNextId(); | 48 var subEventName = name + '/' + IdGenerator.GetNextId(); |
| 49 var newEvent = createCustomEvent(subEventName, schema, options); | 49 var newEvent = createCustomEvent(subEventName, schema, options); |
| 50 | 50 |
| 51 var view = GuestViewInternalNatives.GetViewFromID(webviewId || 0); | 51 var view = GuestViewInternalNatives.GetViewFromID(webviewId || 0); |
| 52 if (view) { | 52 if (view) { |
| 53 view.events.addScopedListener( | 53 view.events.addScopedListener( |
| 54 WebRequestMessageEvent, | 54 WebRequestMessageEvent, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 } | 314 } |
| 315 }; | 315 }; |
| 316 | 316 |
| 317 WebViewEvents.prototype.handleSizeChangedEvent = function(event, eventName) { | 317 WebViewEvents.prototype.handleSizeChangedEvent = function(event, eventName) { |
| 318 var webViewEvent = this.makeDomEvent(event, eventName); | 318 var webViewEvent = this.makeDomEvent(event, eventName); |
| 319 this.view.onSizeChanged(webViewEvent); | 319 this.view.onSizeChanged(webViewEvent); |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 // Exports. | 322 // Exports. |
| 323 exports.$set('WebViewEvents', WebViewEvents); | 323 exports.$set('WebViewEvents', WebViewEvents); |
| OLD | NEW |