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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Full-screen implementation for apps v2, using chrome.AppWindow. | 7 * Full-screen implementation for apps v2, using chrome.AppWindow. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 16 matching lines...) Expand all Loading... |
27 this.isMinimized_ = chrome.app.window.current().isMinimized(); | 27 this.isMinimized_ = chrome.app.window.current().isMinimized(); |
28 | 28 |
29 /** | 29 /** |
30 * @type {?boolean} The most recent full-screen state passed to the callback. | 30 * @type {?boolean} The most recent full-screen state passed to the callback. |
31 * This guards against redundant invocations, as as would otherwise occur | 31 * This guards against redundant invocations, as as would otherwise occur |
32 * in response to a full-screen -> maximized -> unmaximized transition, | 32 * in response to a full-screen -> maximized -> unmaximized transition, |
33 * because this results in two onRestored callbacks. | 33 * because this results in two onRestored callbacks. |
34 */ | 34 */ |
35 this.previousCallbackState_ = null; | 35 this.previousCallbackState_ = null; |
36 | 36 |
37 /** | 37 /** @private {string} Internal 'full-screen changed' event name. */ |
38 * @type {string} Internal 'full-screen changed' event name. | |
39 * @private | |
40 */ | |
41 this.kEventName_ = '_fullscreenchanged'; | 38 this.kEventName_ = '_fullscreenchanged'; |
42 | 39 |
43 /** | 40 /** @private {base.EventSourceImpl} */ |
44 * @type {base.EventSourceImpl} | |
45 * @private | |
46 */ | |
47 this.eventSource_ = new base.EventSourceImpl(); | 41 this.eventSource_ = new base.EventSourceImpl(); |
48 this.eventSource_.defineEvents([this.kEventName_]); | 42 this.eventSource_.defineEvents([this.kEventName_]); |
49 | 43 |
50 chrome.app.window.current().onFullscreened.addListener( | 44 chrome.app.window.current().onFullscreened.addListener( |
51 this.onFullscreened_.bind(this)); | 45 this.onFullscreened_.bind(this)); |
52 chrome.app.window.current().onRestored.addListener( | 46 chrome.app.window.current().onRestored.addListener( |
53 this.onRestored_.bind(this)); | 47 this.onRestored_.bind(this)); |
54 chrome.app.window.current().onMinimized.addListener( | 48 chrome.app.window.current().onMinimized.addListener( |
55 this.onMinimized_.bind(this)); | 49 this.onMinimized_.bind(this)); |
56 | 50 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 /** | 133 /** |
140 * @param {boolean} isFullscreen | 134 * @param {boolean} isFullscreen |
141 * @private | 135 * @private |
142 */ | 136 */ |
143 remoting.FullscreenAppsV2.prototype.raiseEvent_ = function(isFullscreen) { | 137 remoting.FullscreenAppsV2.prototype.raiseEvent_ = function(isFullscreen) { |
144 if (isFullscreen !== this.previousCallbackState_) { | 138 if (isFullscreen !== this.previousCallbackState_) { |
145 this.previousCallbackState_ = isFullscreen; | 139 this.previousCallbackState_ = isFullscreen; |
146 this.eventSource_.raiseEvent(this.kEventName_, isFullscreen); | 140 this.eventSource_.raiseEvent(this.kEventName_, isFullscreen); |
147 } | 141 } |
148 }; | 142 }; |
OLD | NEW |