Index: chrome/browser/resources/file_manager/js/image_editor/media_controls.js |
diff --git a/chrome/browser/resources/file_manager/js/image_editor/media_controls.js b/chrome/browser/resources/file_manager/js/image_editor/media_controls.js |
index 61406659ba2393705d262421ea74fd20e3a0ba9e..264ae657a04617d304e90b1f30e83979ffe691df 100644 |
--- a/chrome/browser/resources/file_manager/js/image_editor/media_controls.js |
+++ b/chrome/browser/resources/file_manager/js/image_editor/media_controls.js |
@@ -20,6 +20,9 @@ function MediaControls(mediaElement, containerElement) { |
this.setupPlaybackControls_(); |
this.setupMediaEvents_(); |
+ |
+ this.document_.defaultView.addEventListener( |
+ 'resize', this.onWindowResize.bind(this)); |
} |
/** |
@@ -279,8 +282,28 @@ MediaControls.prototype.onVolumeMouseDown_ = function () { |
}; |
MediaControls.prototype.onFullscreenButtonClick_ = function() { |
- this.fullscreenButton_.classList.toggle('on'); |
- // TODO: invoke the actual full screen mode |
+ if (chrome.fileBrowserPrivate) { |
+ chrome.fileBrowserPrivate.toggleFullscreen(); |
+ } |
+}; |
+ |
+MediaControls.prototype.onWindowResize = function() { |
+ // There is no notification to tell us when the user enters/leaves the |
+ // fullscreen mode using the built-in Chrome controls. All we can do is |
+ // query the current fullscreen state. |
+ // The best place to do it is a window resize handler. |
+ if (chrome.fileBrowserPrivate) { |
+ chrome.fileBrowserPrivate.isFullscreen( |
+ this.updateFullscreenStatus_.bind(this)); |
+ } |
+}; |
+ |
+MediaControls.prototype.updateFullscreenStatus_ = function(on) { |
+ if (on) { |
+ this.fullscreenButton_.classList.add('on'); |
+ } else { |
+ this.fullscreenButton_.classList.remove('on'); |
+ } |
}; |
/** |