Index: remoting/webapp/crd/js/fullscreen_v1.js |
diff --git a/remoting/webapp/crd/js/fullscreen_v1.js b/remoting/webapp/crd/js/fullscreen_v1.js |
index a68a77bc27cbed2ec3f5c3db9f59bd868de01769..dc967684f93a25971166cbdfaf5030b5ede582e7 100644 |
--- a/remoting/webapp/crd/js/fullscreen_v1.js |
+++ b/remoting/webapp/crd/js/fullscreen_v1.js |
@@ -59,18 +59,28 @@ remoting.FullscreenAppsV1.prototype.activate = function( |
} |
}; |
+/** @return {void} */ |
remoting.FullscreenAppsV1.prototype.toggle = function() { |
this.activate(!this.isActive()); |
}; |
+/** |
+ * @return {boolean} True if full-screen mode is active. |
+ */ |
remoting.FullscreenAppsV1.prototype.isActive = function() { |
return document.webkitIsFullScreen; |
}; |
+/** |
+ * @param {function(boolean=):void} callback |
+ */ |
remoting.FullscreenAppsV1.prototype.addListener = function(callback) { |
this.eventSource_.addEventListener(this.kEventName_, callback); |
}; |
+/** |
+ * @param {function(boolean=):void} callback |
+ */ |
remoting.FullscreenAppsV1.prototype.removeListener = function(callback) { |
this.eventSource_.removeEventListener(this.kEventName_, callback); |
}; |
@@ -79,20 +89,20 @@ remoting.FullscreenAppsV1.prototype.removeListener = function(callback) { |
* @private |
*/ |
remoting.FullscreenAppsV1.prototype.onFullscreenChanged_ = function() { |
+ /** @this {remoting.FullscreenAppsV1} */ |
+ var checkIsActive = function() { |
+ if (this.isActive()) { |
+ document.body.classList.add('fullscreen'); |
+ } else { |
+ document.body.classList.remove('fullscreen'); |
+ } |
+ this.eventSource_.raiseEvent(this.kEventName_, this.isActive()); |
+ }; |
+ |
// Querying full-screen immediately after the webkitfullscreenchange |
// event fires sometimes gives the wrong answer on Mac, perhaps due to |
// the time taken to animate presentation mode. Since I haven't been able |
// to isolate the exact repro steps, and we're not planning on using this |
// API for much longer, this hack will suffice for now. |
- window.setTimeout( |
- /** @this {remoting.FullscreenAppsV1} */ |
- function() { |
- if (this.isActive()) { |
- document.body.classList.add('fullscreen'); |
- } else { |
- document.body.classList.remove('fullscreen'); |
- } |
- this.eventSource_.raiseEvent(this.kEventName_, this.isActive()); |
- }.bind(this), |
- 500); |
+ window.setTimeout(checkIsActive.bind(this), 500); |
}; |