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

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

Issue 618823002: GuestView: Move lifetime management out of content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 6 years, 2 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
« no previous file with comments | « extensions/renderer/resources/web_view.js ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 WebViewInternal. 5 // Event management for WebViewInternal.
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Constructor. 177 // Constructor.
178 function WebViewEvents(webViewInternal, viewInstanceId) { 178 function WebViewEvents(webViewInternal, viewInstanceId) {
179 this.webViewInternal = webViewInternal; 179 this.webViewInternal = webViewInternal;
180 this.viewInstanceId = viewInstanceId; 180 this.viewInstanceId = viewInstanceId;
181 this.setup(); 181 this.setup();
182 } 182 }
183 183
184 // Sets up events. 184 // Sets up events.
185 WebViewEvents.prototype.setup = function() { 185 WebViewEvents.prototype.setup = function() {
186 this.setupFrameNameChangedEvent(); 186 this.setupFrameNameChangedEvent();
187 this.setupPluginDestroyedEvent();
188 this.setupWebRequestEvents(); 187 this.setupWebRequestEvents();
189 this.webViewInternal.setupExperimentalContextMenus(); 188 this.webViewInternal.setupExperimentalContextMenus();
190 189
191 var events = this.getEvents(); 190 var events = this.getEvents();
192 for (var eventName in events) { 191 for (var eventName in events) {
193 this.setupEvent(eventName, events[eventName]); 192 this.setupEvent(eventName, events[eventName]);
194 } 193 }
195 }; 194 };
196 195
197 WebViewEvents.prototype.setupFrameNameChangedEvent = function() { 196 WebViewEvents.prototype.setupFrameNameChangedEvent = function() {
198 FrameNameChangedEvent.addListener(function(e) { 197 FrameNameChangedEvent.addListener(function(e) {
199 this.webViewInternal.onFrameNameChanged(e.name); 198 this.webViewInternal.onFrameNameChanged(e.name);
200 }.bind(this), {instanceId: this.viewInstanceId}); 199 }.bind(this), {instanceId: this.viewInstanceId});
201 }; 200 };
202 201
203 WebViewEvents.prototype.setupPluginDestroyedEvent = function() {
204 PluginDestroyedEvent.addListener(function(e) {
205 this.webViewInternal.onPluginDestroyed();
206 }.bind(this), {instanceId: this.viewInstanceId});
207 };
208
209 WebViewEvents.prototype.setupWebRequestEvents = function() { 202 WebViewEvents.prototype.setupWebRequestEvents = function() {
210 var request = {}; 203 var request = {};
211 var createWebRequestEvent = function(webRequestEvent) { 204 var createWebRequestEvent = function(webRequestEvent) {
212 return function() { 205 return function() {
213 if (!this[webRequestEvent.name]) { 206 if (!this[webRequestEvent.name]) {
214 this[webRequestEvent.name] = 207 this[webRequestEvent.name] =
215 new WebRequestEvent( 208 new WebRequestEvent(
216 'webViewInternal.' + webRequestEvent.name, 209 'webViewInternal.' + webRequestEvent.name,
217 webRequestEvent.parameters, 210 webRequestEvent.parameters,
218 webRequestEvent.extraParameters, webRequestEvent.options, 211 webRequestEvent.extraParameters, webRequestEvent.options,
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 606 }
614 }; 607 };
615 608
616 WebViewEvents.prototype.handleSizeChangedEvent = function( 609 WebViewEvents.prototype.handleSizeChangedEvent = function(
617 event, webViewEvent) { 610 event, webViewEvent) {
618 this.webViewInternal.onSizeChanged(webViewEvent); 611 this.webViewInternal.onSizeChanged(webViewEvent);
619 }; 612 };
620 613
621 exports.WebViewEvents = WebViewEvents; 614 exports.WebViewEvents = WebViewEvents;
622 exports.CreateEvent = CreateEvent; 615 exports.CreateEvent = CreateEvent;
OLDNEW
« no previous file with comments | « extensions/renderer/resources/web_view.js ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698