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 CreateEvent = require('guestViewEvents').CreateEvent; | 8 var CreateEvent = require('guestViewEvents').CreateEvent; |
9 var EventBindings = require('event_bindings'); | 9 var EventBindings = require('event_bindings'); |
10 var GuestViewInternal = getInternalApi ? | 10 var GuestViewInternal = getInternalApi ? |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 this.pendingAction = null; | 88 this.pendingAction = null; |
89 this.performNextAction(); | 89 this.performNextAction(); |
90 }; | 90 }; |
91 | 91 |
92 // Perform the next action in the queue, if one exists. | 92 // Perform the next action in the queue, if one exists. |
93 GuestViewImpl.prototype.performNextAction = function() { | 93 GuestViewImpl.prototype.performNextAction = function() { |
94 // Make sure that there is not already an action in progress, and that there | 94 // Make sure that there is not already an action in progress, and that there |
95 // exists a queued action to perform. | 95 // exists a queued action to perform. |
96 if (!this.pendingAction && this.actionQueue.length) { | 96 if (!this.pendingAction && this.actionQueue.length) { |
97 this.pendingAction = this.actionQueue.shift(); | 97 this.pendingAction = $Array.shift(this.actionQueue); |
98 this.pendingAction(); | 98 this.pendingAction(); |
99 } | 99 } |
100 }; | 100 }; |
101 | 101 |
102 // Check the current state to see if the proposed action is valid. Returns false | 102 // Check the current state to see if the proposed action is valid. Returns false |
103 // if invalid. | 103 // if invalid. |
104 GuestViewImpl.prototype.checkState = function(action) { | 104 GuestViewImpl.prototype.checkState = function(action) { |
105 // Create an error prefix based on the proposed action. | 105 // Create an error prefix based on the proposed action. |
106 var errorPrefix = 'Error calling ' + action + ': '; | 106 var errorPrefix = 'Error calling ' + action + ': '; |
107 | 107 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 var internal = privates(this).internal; | 360 var internal = privates(this).internal; |
361 return internal.id; | 361 return internal.id; |
362 }; | 362 }; |
363 | 363 |
364 // Exports | 364 // Exports |
365 if (!apiBridge) { | 365 if (!apiBridge) { |
366 exports.$set('GuestView', GuestView); | 366 exports.$set('GuestView', GuestView); |
367 exports.$set('GuestViewImpl', GuestViewImpl); | 367 exports.$set('GuestViewImpl', GuestViewImpl); |
368 exports.$set('ResizeEvent', ResizeEvent); | 368 exports.$set('ResizeEvent', ResizeEvent); |
369 } | 369 } |
OLD | NEW |