Chromium Code Reviews| Index: remoting/webapp/crd/js/fullscreen_v2.js |
| diff --git a/remoting/webapp/crd/js/fullscreen_v2.js b/remoting/webapp/crd/js/fullscreen_v2.js |
| index ea20f9000f7185ce7554154ac9890fc1bbec28dc..d6ce402d8bd67dca037918eeca96b35fcb0612fe 100644 |
| --- a/remoting/webapp/crd/js/fullscreen_v2.js |
| +++ b/remoting/webapp/crd/js/fullscreen_v2.js |
| @@ -18,13 +18,13 @@ var remoting = remoting || {}; |
| */ |
| remoting.FullscreenAppsV2 = function() { |
| /** |
| - * @type {boolean} True if the next onRestored event should cause callbacks |
| - * to be notified of a full-screen changed event. onRestored fires when |
| - * full-screen mode is exited and also when the window is restored from |
| - * being minimized; callbacks should not be notified of the latter. |
| + * @type {boolean} True if the window is minimized. onRestored fires when the |
| + * the window transitions from minimized to any other state, but since we |
| + * only want transitions from full-screen to windowed to cause a callback, |
|
kelvinp
2015/01/22 17:42:08
s/cause/call
Jamie
2015/01/22 23:27:31
Cause is acceptable here. Apart from anything else
kelvinp
2015/01/23 00:14:59
Acknowledged.
|
| + * we must keep track of the minimized state of the window. |
| * @private |
| */ |
| - this.notifyCallbacksOnRestore_ = this.isActive(); |
| + this.isMinimized_ = chrome.app.window.current().isMinimized(); |
| /** |
| * @type {string} Internal 'full-screen changed' event name |
| @@ -43,6 +43,8 @@ remoting.FullscreenAppsV2 = function() { |
| this.onFullscreened_.bind(this)); |
| chrome.app.window.current().onRestored.addListener( |
| this.onRestored_.bind(this)); |
| + chrome.app.window.current().onMinimized.addListener( |
| + this.onMinimized_.bind(this)); |
| }; |
| remoting.FullscreenAppsV2.prototype.activate = function( |
| @@ -91,15 +93,20 @@ remoting.FullscreenAppsV2.prototype.removeListener = function(callback) { |
| }; |
| remoting.FullscreenAppsV2.prototype.onFullscreened_ = function() { |
| - this.notifyCallbacksOnRestore_ = true; |
| + this.isMinimized_ = false; |
| this.eventSource_.raiseEvent(this.kEventName_, true); |
| document.body.classList.add('fullscreen'); |
| }; |
| remoting.FullscreenAppsV2.prototype.onRestored_ = function() { |
| - document.body.classList.remove('fullscreen'); |
| - if (this.notifyCallbacksOnRestore_) { |
| + if (!this.isMinimized_) { |
|
kelvinp
2015/01/22 17:42:08
According to
OnRestored is called whenever the wi
Jamie
2015/01/22 23:27:31
That's a valid observation. I had a go at adding a
kelvinp
2015/01/23 00:14:59
Maybe we can add a member variable isFullScreened
Jamie
2015/01/23 00:44:16
Done.
|
| + document.body.classList.remove('fullscreen'); |
| this.notifyCallbacksOnRestore_ = false; |
| this.eventSource_.raiseEvent(this.kEventName_, false); |
| } |
| + this.isMinimized_ = false; |
| +}; |
| + |
| +remoting.FullscreenAppsV2.prototype.onMinimized_ = function() { |
| + this.isMinimized_ = true; |
| }; |