Commit e766b2c8 authored by Yuki Awano's avatar Yuki Awano

Revert "Gallery: use native header."

This reverts commit 6a31c05f.

TBR=fukino@chromium.org
BUG=488227

Review URL: https://codereview.chromium.org/1173863003.

Cr-Commit-Position: refs/heads/master@{#333680}
parent 7c5d9cbb
...@@ -152,17 +152,14 @@ input[type='checkbox']:checked { ...@@ -152,17 +152,14 @@ input[type='checkbox']:checked {
/* Toolbar */ /* Toolbar */
.gallery > .header,
.gallery > .toolbar { .gallery > .toolbar {
-webkit-box-align: stretch; -webkit-box-align: stretch;
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
-webkit-box-pack: start; -webkit-box-pack: start;
background-color: rgba(40, 42, 45, 0.9);
border-top: 1px solid rgba(50, 50, 50, 0.8);
display: flex; display: flex;
height: 55px;
left: 0; left: 0;
opacity: 0; opacity: 0;
overflow: hidden;
padding: 0 10px; padding: 0 10px;
pointer-events: none; pointer-events: none;
position: absolute; position: absolute;
...@@ -170,10 +167,35 @@ input[type='checkbox']:checked { ...@@ -170,10 +167,35 @@ input[type='checkbox']:checked {
transition: opacity 300ms ease; transition: opacity 300ms ease;
} }
.gallery > .toolbar.top { .gallery > .header {
-webkit-app-region: drag;
-webkit-box-align: center;
-webkit-box-pack: end;
background-color: rgba(30, 30, 30, 0.8);
border-bottom: 1px solid rgba(50, 50, 50, 0.8);
display: -webkit-box;
height: 45px;
top: 0; top: 0;
} }
.gallery > .toolbar {
background-color: rgba(40, 42, 45, 0.9);
}
.gallery .header button {
-webkit-app-region: no-drag;
}
.gallery > .toolbar {
border-top: 1px solid rgba(50, 50, 50, 0.8);
height: 55px;
overflow: hidden;
}
.gallery > .toolbar.top {
top: 45px; /* Header height. */
}
.gallery > .toolbar.bottom { .gallery > .toolbar.bottom {
bottom: 0; bottom: 0;
} }
...@@ -204,6 +226,7 @@ input[type='checkbox']:checked { ...@@ -204,6 +226,7 @@ input[type='checkbox']:checked {
visibility: visible; visibility: visible;
} }
.gallery[tools]:not([slideshow]) > .header,
.gallery[tools]:not([slideshow]) > .toolbar { .gallery[tools]:not([slideshow]) > .toolbar {
opacity: 1; opacity: 1;
pointer-events: auto; pointer-events: auto;
...@@ -566,7 +589,9 @@ input[type='checkbox']:checked { ...@@ -566,7 +589,9 @@ input[type='checkbox']:checked {
visibility: visible; visibility: visible;
} }
.gallery .header button,
.gallery .toolbar button, .gallery .toolbar button,
.gallery .header button[disabled],
.gallery .toolbar button[disabled] { .gallery .toolbar button[disabled] {
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
background-position: center; background-position: center;
...@@ -583,12 +608,17 @@ input[type='checkbox']:checked { ...@@ -583,12 +608,17 @@ input[type='checkbox']:checked {
z-index: 10; z-index: 10;
} }
.gallery .header button,
.gallery .toolbar button { .gallery .toolbar button {
height: 40px; height: 40px;
min-width: 40px; /* Reset. */ min-width: 40px; /* Reset. */
width: 40px; width: 40px;
} }
.gallery .header button {
margin: 6px 0;
}
.gallery .toolbar button:focus { .gallery .toolbar button:focus {
z-index: 11; z-index: 11;
} }
...@@ -617,13 +647,17 @@ input[type='checkbox']:checked { ...@@ -617,13 +647,17 @@ input[type='checkbox']:checked {
} }
.gallery .header button:hover,
.gallery .toolbar button:hover { .gallery .toolbar button:hover {
background-color: rgba(31, 31, 31, 1); background-color: rgba(31, 31, 31, 1);
color: white; color: white;
} }
.gallery .header button:active,
.gallery .toolbar button:active, .gallery .toolbar button:active,
.gallery .header button[pressed],
.gallery .toolbar button[pressed], .gallery .toolbar button[pressed],
.gallery .header button[pressed]:hover,
.gallery .toolbar button[pressed]:hover { .gallery .toolbar button[pressed]:hover {
background-color: rgba(240, 240, 240, 1); background-color: rgba(240, 240, 240, 1);
color: black; color: black;
...@@ -1169,7 +1203,7 @@ input[type='checkbox']:checked { ...@@ -1169,7 +1203,7 @@ input[type='checkbox']:checked {
overflow-y: hidden; overflow-y: hidden;
position: absolute; position: absolute;
right: 0; right: 0;
top: 55px; /* Toolbar height. */ top: 100px; /* Header + Toolbar height. */
/* transition-duration is set in Javascript. */ /* transition-duration is set in Javascript. */
transition-property: transform; transition-property: transform;
...@@ -1329,6 +1363,35 @@ input[type='checkbox']:checked { ...@@ -1329,6 +1363,35 @@ input[type='checkbox']:checked {
margin-left: -2px; margin-left: -2px;
} }
.gallery > .header > button {
-webkit-margin-start: 10px;
cursor: default;
height: 32px;
min-width: 32px;
width: 32px;
}
.gallery > .header > .minimize-button {
background: -webkit-image-set(
url(chrome://resources/images/apps/topbar_button_minimize.png) 1x,
url(chrome://resources/images/2x/apps/topbar_button_minimize.png) 2x)
center;
}
.gallery > .header > .maximize-button {
background: -webkit-image-set(
url(chrome://resources/images/apps/topbar_button_maximize.png) 1x,
url(chrome://resources/images/2x/apps/topbar_button_maximize.png) 2x)
center;
}
.gallery > .header > .close-button {
background: -webkit-image-set(
url(chrome://resources/images/apps/topbar_button_close.png) 1x,
url(chrome://resources/images/2x/apps/topbar_button_close.png) 2x)
center;
}
.debug-me .load-target-content-metadata::before, .debug-me .load-target-content-metadata::before,
.debug-me .load-target-external-metadata::before, .debug-me .load-target-external-metadata::before,
.debug-me .load-target-file-entry::before { .debug-me .load-target-file-entry::before {
......
...@@ -9,13 +9,11 @@ ...@@ -9,13 +9,11 @@
*/ */
var windowCreateOptions = { var windowCreateOptions = {
id: 'gallery', id: 'gallery',
outerBounds: { innerBounds: {
minWidth: 820, minWidth: 820,
minHeight: 554 minHeight: 554
}, },
frame: { frame: 'none'
color: '#1E2023'
}
}; };
/** /**
......
...@@ -29,6 +29,15 @@ function Gallery(volumeManager) { ...@@ -29,6 +29,15 @@ function Gallery(volumeManager) {
*/ */
this.context_ = { this.context_ = {
appWindow: chrome.app.window.current(), 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() {}, onAppRegionChanged: function() {},
readonlyDirName: '', readonlyDirName: '',
displayStringFunction: function() { return ''; }, displayStringFunction: function() { return ''; },
...@@ -90,6 +99,29 @@ function Gallery(volumeManager) { ...@@ -90,6 +99,29 @@ function Gallery(volumeManager) {
this.topToolbar_ = queryRequiredElement(document, '#top-toolbar'); this.topToolbar_ = queryRequiredElement(document, '#top-toolbar');
this.bottomToolbar_ = queryRequiredElement(document, '#bottom-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_, this.filenameSpacer_ = queryRequiredElement(this.topToolbar_,
'.filename-spacer'); '.filename-spacer');
this.filenameEdit_ = util.createChild(this.filenameSpacer_, this.filenameEdit_ = util.createChild(this.filenameSpacer_,
...@@ -387,6 +419,45 @@ Gallery.prototype.loadInternal_ = function(entries, selectedEntries) { ...@@ -387,6 +419,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. * @return {boolean} True if some tool is currently active.
*/ */
......
...@@ -203,7 +203,6 @@ function SlideMode(container, content, topToolbar, bottomToolbar, prompt, ...@@ -203,7 +203,6 @@ function SlideMode(container, content, topToolbar, bottomToolbar, prompt,
*/ */
this.spinnerTimer_ = null; this.spinnerTimer_ = null;
this.context_.appWindow.onRestored.addListener(this.onRestored_.bind(this));
window.addEventListener('resize', this.onResize_.bind(this)); window.addEventListener('resize', this.onResize_.bind(this));
// ---------------------------------------------------------------- // ----------------------------------------------------------------
...@@ -1114,9 +1113,7 @@ SlideMode.prototype.onKeyDown = function(event) { ...@@ -1114,9 +1113,7 @@ SlideMode.prototype.onKeyDown = function(event) {
if (this.isSlideshowOn_()) { if (this.isSlideshowOn_()) {
switch (keyID) { switch (keyID) {
// Escape key is captured by the platform to exit full screen. We handle case 'U+001B': // Escape exits the slideshow.
// it by onRestored event.
case 'MediaStop': case 'MediaStop':
this.stopSlideshow_(event); this.stopSlideshow_(event);
break; break;
...@@ -1220,17 +1217,6 @@ SlideMode.prototype.onKeyDown = function(event) { ...@@ -1220,17 +1217,6 @@ SlideMode.prototype.onKeyDown = function(event) {
return true; return true;
}; };
/**
* Restored event handler.
* @private
*/
SlideMode.prototype.onRestored_ = function() {
// Leave slide show since the window should not be in full screen when
// onRestored event is dispatched.
if (this.isSlideshowOn_())
this.stopSlideshow_();
};
/** /**
* Resize handler. * Resize handler.
* @private * @private
......
...@@ -16,7 +16,7 @@ function openSingleImage(testVolumeName, volumeType) { ...@@ -16,7 +16,7 @@ function openSingleImage(testVolumeName, volumeType) {
var launchedPromise = launch(testVolumeName, volumeType, [ENTRIES.desktop]); var launchedPromise = launch(testVolumeName, volumeType, [ENTRIES.desktop]);
return launchedPromise.then(function(args) { return launchedPromise.then(function(args) {
var WIDTH = 880; var WIDTH = 880;
var HEIGHT = 603; /* Inner height 570px + native header 33px. */ var HEIGHT = 570;
var appId = args.appId; var appId = args.appId;
var resizedWindowPromise = gallery.callRemoteTestUtil( var resizedWindowPromise = gallery.callRemoteTestUtil(
'resizeWindow', appId, [WIDTH, HEIGHT] 'resizeWindow', appId, [WIDTH, HEIGHT]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment