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

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

Issue 845363004: <webview>, <appview> and <extensionoptions> can run in a detached state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 11 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 // This module implements a wrapper for a guestview that manages its 5 // This module implements a wrapper for a guestview that manages its
6 // creation, attaching, and destruction. 6 // creation, attaching, and destruction.
7 7
8 var EventBindings = require('event_bindings'); 8 var EventBindings = require('event_bindings');
9 var GuestViewInternal = 9 var GuestViewInternal =
10 require('binding').Binding.create('guestViewInternal').generate(); 10 require('binding').Binding.create('guestViewInternal').generate();
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 this.handleCallback(callback); 213 this.handleCallback(callback);
214 return; 214 return;
215 } 215 }
216 216
217 if (this.state == GUEST_STATE_START) { 217 if (this.state == GUEST_STATE_START) {
218 // destroy() does nothing in this case. 218 // destroy() does nothing in this case.
219 this.handleCallback(callback); 219 this.handleCallback(callback);
220 return; 220 return;
221 } 221 }
222 222
223 // If this guest is attached, then detach it first.
224 if (!!this.internalInstanceId) {
225 GuestViewInternalNatives.DetachGuest(this.internalInstanceId);
226 }
227
223 GuestViewInternal.destroyGuest(this.id, 228 GuestViewInternal.destroyGuest(this.id,
224 this.handleCallback.bind(this, callback)); 229 this.handleCallback.bind(this, callback));
225 230
226 // Reset the state of the destroyed guest; 231 // Reset the state of the destroyed guest;
227 this.contentWindow = null; 232 this.contentWindow = null;
228 this.id = 0; 233 this.id = 0;
229 this.internalInstanceId = 0; 234 this.internalInstanceId = 0;
230 this.state = GUEST_STATE_START; 235 this.state = GUEST_STATE_START;
231 if (ResizeEvent.hasListener(this.callOnResize)) { 236 if (ResizeEvent.hasListener(this.callOnResize)) {
232 ResizeEvent.removeListener(this.callOnResize); 237 ResizeEvent.removeListener(this.callOnResize);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 }; 322 };
318 323
319 // Returns the ID for this guestview. 324 // Returns the ID for this guestview.
320 GuestView.prototype.getId = function() { 325 GuestView.prototype.getId = function() {
321 var internal = privates(this).internal; 326 var internal = privates(this).internal;
322 return internal.id; 327 return internal.id;
323 }; 328 };
324 329
325 // Exports 330 // Exports
326 exports.GuestView = GuestView; 331 exports.GuestView = GuestView;
OLDNEW
« no previous file with comments | « extensions/renderer/resources/guest_view/app_view.js ('k') | extensions/renderer/resources/guest_view/guest_view_container.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698