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

Side by Side Diff: remoting/webapp/crd/js/fullscreen_v1.js

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 /** 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';
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 } 53 }
54 54
55 if (fullscreen) { 55 if (fullscreen) {
56 document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); 56 document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
57 } else { 57 } else {
58 document.webkitCancelFullScreen(); 58 document.webkitCancelFullScreen();
59 } 59 }
60 }; 60 };
61 61
62 /** @return {void} */
62 remoting.FullscreenAppsV1.prototype.toggle = function() { 63 remoting.FullscreenAppsV1.prototype.toggle = function() {
63 this.activate(!this.isActive()); 64 this.activate(!this.isActive());
64 }; 65 };
65 66
67 /**
68 * @return {boolean} True if full-screen mode is active.
69 */
66 remoting.FullscreenAppsV1.prototype.isActive = function() { 70 remoting.FullscreenAppsV1.prototype.isActive = function() {
67 return document.webkitIsFullScreen; 71 return document.webkitIsFullScreen;
68 }; 72 };
69 73
74 /**
75 * @param {function(boolean=):void} callback
76 */
70 remoting.FullscreenAppsV1.prototype.addListener = function(callback) { 77 remoting.FullscreenAppsV1.prototype.addListener = function(callback) {
71 this.eventSource_.addEventListener(this.kEventName_, callback); 78 this.eventSource_.addEventListener(this.kEventName_, callback);
72 }; 79 };
73 80
81 /**
82 * @param {function(boolean=):void} callback
83 */
74 remoting.FullscreenAppsV1.prototype.removeListener = function(callback) { 84 remoting.FullscreenAppsV1.prototype.removeListener = function(callback) {
75 this.eventSource_.removeEventListener(this.kEventName_, callback); 85 this.eventSource_.removeEventListener(this.kEventName_, callback);
76 }; 86 };
77 87
78 /** 88 /**
79 * @private 89 * @private
80 */ 90 */
81 remoting.FullscreenAppsV1.prototype.onFullscreenChanged_ = function() { 91 remoting.FullscreenAppsV1.prototype.onFullscreenChanged_ = function() {
92 /** @type {remoting.FullscreenAppsV1} */
93 var that = this;
82 // Querying full-screen immediately after the webkitfullscreenchange 94 // Querying full-screen immediately after the webkitfullscreenchange
83 // event fires sometimes gives the wrong answer on Mac, perhaps due to 95 // event fires sometimes gives the wrong answer on Mac, perhaps due to
84 // the time taken to animate presentation mode. Since I haven't been able 96 // the time taken to animate presentation mode. Since I haven't been able
85 // to isolate the exact repro steps, and we're not planning on using this 97 // to isolate the exact repro steps, and we're not planning on using this
86 // API for much longer, this hack will suffice for now. 98 // API for much longer, this hack will suffice for now.
87 window.setTimeout( 99 window.setTimeout(
88 /** @this {remoting.FullscreenAppsV1} */
89 function() { 100 function() {
90 if (this.isActive()) { 101 if (that.isActive()) {
91 document.body.classList.add('fullscreen'); 102 document.body.classList.add('fullscreen');
92 } else { 103 } else {
93 document.body.classList.remove('fullscreen'); 104 document.body.classList.remove('fullscreen');
94 } 105 }
95 this.eventSource_.raiseEvent(this.kEventName_, this.isActive()); 106 that.eventSource_.raiseEvent(that.kEventName_, that.isActive());
96 }.bind(this), 107 }.bind(that),
97 500); 108 500);
98 }; 109 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698