| 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 v1, using webkitRequestFullscreen. | 7 * Full-screen implementation for apps v1, using webkitRequestFullscreen. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| 11 | 11 |
| 12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
| 13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * @constructor | 16 * @constructor |
| 17 * @implements {remoting.Fullscreen} | 17 * @implements {remoting.Fullscreen} |
| 18 */ | 18 */ |
| 19 remoting.FullscreenAppsV1 = function() { | 19 remoting.FullscreenAppsV1 = function() { |
| 20 /** | 20 /** @private {string} Internal 'full-screen changed' event name */ |
| 21 * @type {string} Internal 'full-screen changed' event name | |
| 22 * @private | |
| 23 */ | |
| 24 this.kEventName_ = '_fullscreenchanged'; | 21 this.kEventName_ = '_fullscreenchanged'; |
| 25 | 22 |
| 26 /** | 23 /** @private {base.EventSourceImpl} */ |
| 27 * @type {base.EventSourceImpl} | |
| 28 * @private | |
| 29 */ | |
| 30 this.eventSource_ = new base.EventSourceImpl(); | 24 this.eventSource_ = new base.EventSourceImpl(); |
| 31 this.eventSource_.defineEvents([this.kEventName_]); | 25 this.eventSource_.defineEvents([this.kEventName_]); |
| 32 | 26 |
| 33 document.addEventListener( | 27 document.addEventListener( |
| 34 'webkitfullscreenchange', | 28 'webkitfullscreenchange', |
| 35 this.onFullscreenChanged_.bind(this), | 29 this.onFullscreenChanged_.bind(this), |
| 36 false); | 30 false); |
| 37 }; | 31 }; |
| 38 | 32 |
| 39 remoting.FullscreenAppsV1.prototype.activate = function( | 33 remoting.FullscreenAppsV1.prototype.activate = function( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 this.eventSource_.raiseEvent(this.kEventName_, this.isActive()); | 93 this.eventSource_.raiseEvent(this.kEventName_, this.isActive()); |
| 100 }; | 94 }; |
| 101 | 95 |
| 102 // Querying full-screen immediately after the webkitfullscreenchange | 96 // Querying full-screen immediately after the webkitfullscreenchange |
| 103 // event fires sometimes gives the wrong answer on Mac, perhaps due to | 97 // event fires sometimes gives the wrong answer on Mac, perhaps due to |
| 104 // the time taken to animate presentation mode. Since I haven't been able | 98 // the time taken to animate presentation mode. Since I haven't been able |
| 105 // to isolate the exact repro steps, and we're not planning on using this | 99 // to isolate the exact repro steps, and we're not planning on using this |
| 106 // API for much longer, this hack will suffice for now. | 100 // API for much longer, this hack will suffice for now. |
| 107 window.setTimeout(checkIsActive.bind(this), 500); | 101 window.setTimeout(checkIsActive.bind(this), 500); |
| 108 }; | 102 }; |
| OLD | NEW |