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

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

Issue 99703002: [Files.app] Skip non file manager window in checking existing file manager instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/background/js/background.js
diff --git a/chrome/browser/resources/file_manager/background/js/background.js b/chrome/browser/resources/file_manager/background/js/background.js
index fe031e66eecdb41d5e392625bae5addc5caf7233..54c5390211758af5b607da8e2202f53a52a7394b 100644
--- a/chrome/browser/resources/file_manager/background/js/background.js
+++ b/chrome/browser/resources/file_manager/background/js/background.js
@@ -374,6 +374,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
type == LaunchType.FOCUS_ANY_OR_CREATE) {
if (opt_appState && opt_appState.defaultPath) {
for (var key in background.appWindows) {
+ if (!key.match(FILES_ID_PATTERN))
+ continue;
+
var contentWindow = background.appWindows[key].contentWindow;
if (contentWindow.appState &&
opt_appState.defaultPath == contentWindow.appState.defaultPath) {
@@ -391,6 +394,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
if (type == LaunchType.FOCUS_ANY_OR_CREATE) {
// If there is already a focused window, then finish.
for (var key in background.appWindows) {
+ if (!key.match(FILES_ID_PATTERN))
+ continue;
+
// The isFocused() method should always be available, but in case
// Files.app's failed on some error, wrap it with try catch.
try {
@@ -406,6 +412,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
}
// Try to focus the first non-minimized window.
for (var key in background.appWindows) {
+ if (!key.match(FILES_ID_PATTERN))
+ continue;
+
if (!background.appWindows[key].isMinimized()) {
background.appWindows[key].focus();
if (opt_callback)
@@ -416,6 +425,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
}
// Restore and focus any window.
for (var key in background.appWindows) {
+ if (!key.match(FILES_ID_PATTERN))
+ continue;
+
background.appWindows[key].focus();
if (opt_callback)
opt_callback(key);
« 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