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

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

Issue 794803002: Refactor: cleanup declarative_api.cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 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
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
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;
OLDNEW
« extensions/renderer/event_bindings.cc ('K') | « extensions/renderer/resources/event.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698