Commit 3b0830d6 authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

[Files.app] Skip non file manager window in checking existing file manager instance

BUG=318551, 251070
TEST=manually tested

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238355 0039d316-1c4b-4281-b951-d872f2087c98
parent 9cecc735
...@@ -374,6 +374,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) { ...@@ -374,6 +374,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
type == LaunchType.FOCUS_ANY_OR_CREATE) { type == LaunchType.FOCUS_ANY_OR_CREATE) {
if (opt_appState && opt_appState.defaultPath) { if (opt_appState && opt_appState.defaultPath) {
for (var key in background.appWindows) { for (var key in background.appWindows) {
if (!key.match(FILES_ID_PATTERN))
continue;
var contentWindow = background.appWindows[key].contentWindow; var contentWindow = background.appWindows[key].contentWindow;
if (contentWindow.appState && if (contentWindow.appState &&
opt_appState.defaultPath == contentWindow.appState.defaultPath) { opt_appState.defaultPath == contentWindow.appState.defaultPath) {
...@@ -391,6 +394,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) { ...@@ -391,6 +394,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
if (type == LaunchType.FOCUS_ANY_OR_CREATE) { if (type == LaunchType.FOCUS_ANY_OR_CREATE) {
// If there is already a focused window, then finish. // If there is already a focused window, then finish.
for (var key in background.appWindows) { for (var key in background.appWindows) {
if (!key.match(FILES_ID_PATTERN))
continue;
// The isFocused() method should always be available, but in case // The isFocused() method should always be available, but in case
// Files.app's failed on some error, wrap it with try catch. // Files.app's failed on some error, wrap it with try catch.
try { try {
...@@ -406,6 +412,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) { ...@@ -406,6 +412,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
} }
// Try to focus the first non-minimized window. // Try to focus the first non-minimized window.
for (var key in background.appWindows) { for (var key in background.appWindows) {
if (!key.match(FILES_ID_PATTERN))
continue;
if (!background.appWindows[key].isMinimized()) { if (!background.appWindows[key].isMinimized()) {
background.appWindows[key].focus(); background.appWindows[key].focus();
if (opt_callback) if (opt_callback)
...@@ -416,6 +425,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) { ...@@ -416,6 +425,9 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
} }
// Restore and focus any window. // Restore and focus any window.
for (var key in background.appWindows) { for (var key in background.appWindows) {
if (!key.match(FILES_ID_PATTERN))
continue;
background.appWindows[key].focus(); background.appWindows[key].focus();
if (opt_callback) if (opt_callback)
opt_callback(key); opt_callback(key);
......
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