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

Unified Diff: ui/file_manager/gallery/js/gallery.js

Issue 1173863003: Revert "Gallery: use native header." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « ui/file_manager/gallery/js/background.js ('k') | ui/file_manager/gallery/js/slide_mode.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/gallery.js
diff --git a/ui/file_manager/gallery/js/gallery.js b/ui/file_manager/gallery/js/gallery.js
index 4d97d06665ffc2327166848d297fffb1e0e20868..c12c4a7d018821896f0776b89becc8f09f32526c 100644
--- a/ui/file_manager/gallery/js/gallery.js
+++ b/ui/file_manager/gallery/js/gallery.js
@@ -29,6 +29,15 @@ function Gallery(volumeManager) {
*/
this.context_ = {
appWindow: chrome.app.window.current(),
+ onClose: function() { window.close(); },
+ onMaximize: function() {
+ var appWindow = chrome.app.window.current();
+ if (appWindow.isMaximized())
+ appWindow.restore();
+ else
+ appWindow.maximize();
+ },
+ onMinimize: function() { chrome.app.window.current().minimize(); },
onAppRegionChanged: function() {},
readonlyDirName: '',
displayStringFunction: function() { return ''; },
@@ -90,6 +99,29 @@ function Gallery(volumeManager) {
this.topToolbar_ = queryRequiredElement(document, '#top-toolbar');
this.bottomToolbar_ = queryRequiredElement(document, '#bottom-toolbar');
+ var preventDefault = function(event) { event.preventDefault(); };
+
+ var minimizeButton = util.createChild(this.header_,
+ 'minimize-button tool dimmable',
+ 'button');
+ minimizeButton.tabIndex = -1;
+ minimizeButton.addEventListener('click', this.onMinimize_.bind(this));
+ minimizeButton.addEventListener('mousedown', preventDefault);
+
+ var maximizeButton = util.createChild(this.header_,
+ 'maximize-button tool dimmable',
+ 'button');
+ maximizeButton.tabIndex = -1;
+ maximizeButton.addEventListener('click', this.onMaximize_.bind(this));
+ maximizeButton.addEventListener('mousedown', preventDefault);
+
+ var closeButton = util.createChild(this.header_,
+ 'close-button tool dimmable',
+ 'button');
+ closeButton.tabIndex = -1;
+ closeButton.addEventListener('click', this.onClose_.bind(this));
+ closeButton.addEventListener('mousedown', preventDefault);
+
this.filenameSpacer_ = queryRequiredElement(this.topToolbar_,
'.filename-spacer');
this.filenameEdit_ = util.createChild(this.filenameSpacer_,
@@ -388,6 +420,45 @@ Gallery.prototype.loadInternal_ = function(entries, selectedEntries) {
};
/**
+ * Handles user's 'Close' action.
+ * @private
+ */
+Gallery.prototype.onClose_ = function() {
+ this.executeWhenReady(this.context_.onClose);
+};
+
+/**
+ * Handles user's 'Maximize' action (Escape or a click on the X icon).
+ * @private
+ */
+Gallery.prototype.onMaximize_ = function() {
+ this.executeWhenReady(this.context_.onMaximize);
+};
+
+/**
+ * Handles user's 'Maximize' action (Escape or a click on the X icon).
+ * @private
+ */
+Gallery.prototype.onMinimize_ = function() {
+ this.executeWhenReady(this.context_.onMinimize);
+};
+
+/**
+ * Executes a function when the editor is done with the modifications.
+ * @param {function()} callback Function to execute.
+ */
+Gallery.prototype.executeWhenReady = function(callback) {
+ this.currentMode_.executeWhenReady(callback);
+};
+
+/**
+ * @return {!Object} File manager private API.
+ */
+Gallery.getFileManagerPrivate = function() {
+ return chrome.fileManagerPrivate || window.top.chrome.fileManagerPrivate;
+};
+
+/**
* @return {boolean} True if some tool is currently active.
*/
Gallery.prototype.hasActiveTool = function() {
« no previous file with comments | « ui/file_manager/gallery/js/background.js ('k') | ui/file_manager/gallery/js/slide_mode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698