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

Side by Side Diff: extensions/renderer/resources/guest_view/web_view/web_view_events.js

Issue 2973903002: [Extensions Bindings] Introduce a supportsLazyListeners property (Closed)
Patch Set: onMessage event fix Created 3 years, 5 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
OLDNEW
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 DCHECK = requireNative('logging').DCHECK;
8 var DeclarativeWebRequestSchema = 9 var DeclarativeWebRequestSchema =
9 requireNative('schema_registry').GetSchema('declarativeWebRequest'); 10 requireNative('schema_registry').GetSchema('declarativeWebRequest');
10 var GuestViewEvents = require('guestViewEvents').GuestViewEvents; 11 var GuestViewEvents = require('guestViewEvents').GuestViewEvents;
11 var GuestViewInternalNatives = requireNative('guest_view_internal'); 12 var GuestViewInternalNatives = requireNative('guest_view_internal');
12 var IdGenerator = requireNative('id_generator'); 13 var IdGenerator = requireNative('id_generator');
13 var WebRequestEvent = require('webRequestEvent').WebRequestEvent; 14 var WebRequestEvent = require('webRequestEvent').WebRequestEvent;
14 var WebRequestSchema = 15 var WebRequestSchema =
15 requireNative('schema_registry').GetSchema('webRequest'); 16 requireNative('schema_registry').GetSchema('webRequest');
16 var WebViewActionRequests = 17 var WebViewActionRequests =
17 require('webViewActionRequests').WebViewActionRequests; 18 require('webViewActionRequests').WebViewActionRequests;
(...skipping 12 matching lines...) Expand all
30 if (bindingUtil) { 31 if (bindingUtil) {
31 return bindingUtil.createCustomDeclarativeEvent( 32 return bindingUtil.createCustomDeclarativeEvent(
32 name, options.actions, options.conditions, webviewId || 0); 33 name, options.actions, options.conditions, webviewId || 0);
33 } 34 }
34 if (!jsEvent) 35 if (!jsEvent)
35 jsEvent = require('event_bindings').Event; 36 jsEvent = require('event_bindings').Event;
36 return new jsEvent(name, schema, options, webviewId); 37 return new jsEvent(name, schema, options, webviewId);
37 } 38 }
38 39
39 function createCustomEvent(name, schema, options) { 40 function createCustomEvent(name, schema, options) {
40 if (bindingUtil) 41 var supportsLazyListeners = false;
41 return bindingUtil.createCustomEvent(name, undefined, false); 42 if (bindingUtil) {
43 return bindingUtil.createCustomEvent(name, undefined, false,
44 supportsLazyListeners);
45 }
42 if (!jsEvent) 46 if (!jsEvent)
43 jsEvent = require('event_bindings').Event; 47 jsEvent = require('event_bindings').Event;
48
49 if (!options)
50 options = {__proto__: null, supportsLazyListeners: false};
51 DCHECK(!options.supportsLazyListeners);
44 return new jsEvent(name, schema, options); 52 return new jsEvent(name, schema, options);
45 } 53 }
46 54
47 function createOnMessageEvent(name, schema, options, webviewId) { 55 function createOnMessageEvent(name, schema, options, webviewId) {
48 var subEventName = name + '/' + IdGenerator.GetNextId(); 56 var subEventName = name + '/' + IdGenerator.GetNextId();
49 var newEvent = createCustomEvent(subEventName, schema, options); 57 var newEvent = createCustomEvent(subEventName, schema, options);
50 58
51 var view = GuestViewInternalNatives.GetViewFromID(webviewId || 0); 59 var view = GuestViewInternalNatives.GetViewFromID(webviewId || 0);
52 if (view) { 60 if (view) {
53 view.events.addScopedListener( 61 view.events.addScopedListener(
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 322 }
315 }; 323 };
316 324
317 WebViewEvents.prototype.handleSizeChangedEvent = function(event, eventName) { 325 WebViewEvents.prototype.handleSizeChangedEvent = function(event, eventName) {
318 var webViewEvent = this.makeDomEvent(event, eventName); 326 var webViewEvent = this.makeDomEvent(event, eventName);
319 this.view.onSizeChanged(webViewEvent); 327 this.view.onSizeChanged(webViewEvent);
320 }; 328 };
321 329
322 // Exports. 330 // Exports.
323 exports.$set('WebViewEvents', WebViewEvents); 331 exports.$set('WebViewEvents', WebViewEvents);
OLDNEW
« no previous file with comments | « extensions/renderer/resources/guest_view/guest_view_events.js ('k') | extensions/renderer/resources/messaging.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698