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

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

Issue 15980009: Files.app: Fix errors when launching Files.app via "chrome://files" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/js/file_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index 1043e23cafe49b95e2b9f27412c1f927978e2ffc..1bf9650925a81ebdc6c4d530760a5df849c8d1db 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698