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

Unified Diff: chrome/browser/resources/file_manager/js/image_editor/gallery.js

Issue 9565008: Better fullscreen handling for Chrome OS Video Player (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/image_editor/gallery.js
diff --git a/chrome/browser/resources/file_manager/js/image_editor/gallery.js b/chrome/browser/resources/file_manager/js/image_editor/gallery.js
index bc59ba1f6b349a90e5e3071cde46a1cc4e6b6898..4392652a8db5a9b5adf8df26735811f37e000e5a 100644
--- a/chrome/browser/resources/file_manager/js/image_editor/gallery.js
+++ b/chrome/browser/resources/file_manager/js/image_editor/gallery.js
@@ -227,6 +227,10 @@ Gallery.prototype.initDom_ = function(shareActions) {
} else {
this.shareMode_ = null;
}
+
+ Gallery.getFileBrowserPrivate().isFullscreen(function(fullscreen) {
+ this.originalFullscreen_ = fullscreen;
+ }.bind(this));
};
Gallery.blobToURL_ = function(blob) {
@@ -435,24 +439,32 @@ Gallery.prototype.isRenaming_ = function() {
return this.container_.hasAttribute('renaming');
};
+Gallery.getFileBrowserPrivate = function() {
+ return chrome.fileBrowserPrivate || window.top.chrome.fileBrowserPrivate;
+};
+
Gallery.prototype.toggleFullscreen_ = function() {
- if (this.document_.webkitIsFullScreen) {
- this.document_.webkitCancelFullScreen();
- } else {
- this.document_.body.webkitRequestFullScreen();
- }
+ Gallery.getFileBrowserPrivate().toggleFullscreen();
+};
+
+/**
+ * Close the Gallery.
+ */
+Gallery.prototype.close_ = function() {
+ Gallery.getFileBrowserPrivate().isFullscreen(function(fullscreen) {
+ if (this.originalFullscreen_ != fullscreen) {
+ Gallery.getFileBrowserPrivate().toggleFullscreen();
+ }
+ this.closeCallback_();
+ }.bind(this));
};
+/**
+ * Handle user's 'Close' action (Escape or a click on the X icon).
+ */
Gallery.prototype.onClose_ = function() {
- if (this.document_.webkitIsFullScreen) {
- // Closing the Gallery iframe while in full screen will crash the tab.
- this.document_.addEventListener(
- 'webkitfullscreenchange', this.onClose_.bind(this));
- this.document_.webkitCancelFullScreen();
- return;
- }
// TODO: handle write errors gracefully (suggest retry or saving elsewhere).
- this.saveChanges_(this.closeCallback_);
+ this.saveChanges_(this.close_.bind(this));
};
Gallery.prototype.prefetchImage = function(id, content, metadata) {
« no previous file with comments | « chrome/browser/extensions/extension_function_dispatcher.cc ('k') | chrome/browser/resources/file_manager/js/mock_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698