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 // 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 GuestViewInternal = | 8 var GuestViewInternal = |
| 9 require('binding').Binding.create('guestViewInternal').generate(); | 9 require('binding').Binding.create('guestViewInternal').generate(); |
| 10 var GuestViewInternalNatives = requireNative('guest_view_internal'); | 10 var GuestViewInternalNatives = requireNative('guest_view_internal'); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 this.handleCallback(callback); | 179 this.handleCallback(callback); |
| 180 return; | 180 return; |
| 181 } | 181 } |
| 182 | 182 |
| 183 if (this.state == GUEST_STATE_START) { | 183 if (this.state == GUEST_STATE_START) { |
| 184 // destroy() does nothing in this case. | 184 // destroy() does nothing in this case. |
| 185 this.handleCallback(callback); | 185 this.handleCallback(callback); |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 | 188 |
| 189 // If this guest is attached, then detach it first. | |
| 190 if (!!this.internalInstanceId) { | |
| 191 GuestViewInternalNatives.DetachGuest(this.internalInstanceId); | |
| 192 } | |
| 193 | |
| 189 GuestViewInternal.destroyGuest(this.id, | 194 GuestViewInternal.destroyGuest(this.id, |
| 190 this.handleCallback.bind(this, callback)); | 195 this.handleCallback.bind(this, callback)); |
|
paulmeyer
2015/01/13 20:06:33
Spacing; it looks like that extra space was a mist
Fady Samuel
2015/01/13 20:10:34
Done.
| |
| 191 | 196 |
| 192 this.contentWindow = null; | 197 this.contentWindow = null; |
| 193 this.id = 0; | 198 this.id = 0; |
| 194 this.internalInstanceId = 0; | 199 this.internalInstanceId = 0; |
| 195 this.state = GUEST_STATE_START; | 200 this.state = GUEST_STATE_START; |
| 196 }; | 201 }; |
| 197 | 202 |
| 198 // Internal implementation of detach(). | 203 // Internal implementation of detach(). |
| 199 GuestViewImpl.prototype.detachImpl = function(callback) { | 204 GuestViewImpl.prototype.detachImpl = function(callback) { |
| 200 // Check the current state. | 205 // Check the current state. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 }; | 284 }; |
| 280 | 285 |
| 281 // Returns the ID for this guestview. | 286 // Returns the ID for this guestview. |
| 282 GuestView.prototype.getId = function() { | 287 GuestView.prototype.getId = function() { |
| 283 var internal = privates(this).internal; | 288 var internal = privates(this).internal; |
| 284 return internal.id; | 289 return internal.id; |
| 285 }; | 290 }; |
| 286 | 291 |
| 287 // Exports | 292 // Exports |
| 288 exports.GuestView = GuestView; | 293 exports.GuestView = GuestView; |
| OLD | NEW |