Commit b882e041 authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

Files.app: Fix errors when launching Files.app via "chrome://files"

This patch does following when Files.app is launched via "chrome://files".
- Not to call chrome.app.window.current().show().
- Disable Close and Maximize button at the top-right.

BUG=243414
TEST=Open chrome://files and confirm Files.app shows and the close button and the maximize button doesn't work.
R=mtomasz@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203795 0039d316-1c4b-4281-b951-d872f2087c98
parent ba684f0b
......@@ -621,6 +621,10 @@ DialogType.isModal = function(type) {
};
FileManager.prototype.onMaximize = function() {
// Do not maximize when running via chrome://files in a browser.
if (!chrome.app.window.contentWindow)
return;
var appWindow = chrome.app.window.current();
if (appWindow.isMaximized())
appWindow.restore();
......@@ -629,6 +633,10 @@ DialogType.isModal = function(type) {
};
FileManager.prototype.onClose = function() {
// Do not close when running via chrome://files in a browser.
if (!chrome.app.window.contentWindow)
return;
window.close();
};
......@@ -878,10 +886,16 @@ DialogType.isModal = function(type) {
this.initDialogType_();
// Show the window as soon as the UI pre-initialization is done.
// Do not call show() when running via chrome://files in a browser.
if (this.dialogType == DialogType.FULL_PAGE && util.platform.v2()) {
chrome.app.window.current().show();
setTimeout(callback, 100); // Wait until the animation is finished.
// Do not call show() when running via chrome://files in a browser.
if (chrome.app.window.contentWindow) {
chrome.app.window.current().show();
setTimeout(callback, 100); // Wait until the animation is finished.
} else {
console.info('Files.app window is not created yet. Maybe launched ' +
'via chrome://files in a browser?');
callback();
}
} else {
callback();
}
......
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