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

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

Issue 24057006: Let the disable-default-apps option suppress Files.app launch reacting to mount of external devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/background.js
diff --git a/chrome/browser/resources/file_manager/js/background.js b/chrome/browser/resources/file_manager/js/background.js
index c5fad170ddef279be8ebe409a5becba612d1862e..e3384c84b3dc3222f2a70e916ba5d9b3ddab2e21 100644
--- a/chrome/browser/resources/file_manager/js/background.js
+++ b/chrome/browser/resources/file_manager/js/background.js
@@ -390,7 +390,7 @@ function reopenFileManagers() {
* @param {Object} details Details object.
*/
function onExecute(action, details) {
- var urls = details.entries.map(function(e) { return e.toURL() });
+ var urls = details.entries.map(function(e) { return e.toURL(); });
switch (action) {
case 'play':
@@ -402,25 +402,43 @@ function onExecute(action, details) {
break;
default:
- // Every other action opens a Files app window.
- var appState = {
- params: {
- action: action
- },
- defaultPath: details.entries[0].fullPath,
- };
- // For mounted devices just focus any Files.app window. The mounted
- // volume will appear on the navigation list.
- var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE :
- LaunchType.FOCUS_SAME_OR_CREATE;
- launchFileManager(appState,
- undefined, // App ID.
- type);
+ var steps = new AsyncUtil.Queue();
+ var launchEnable = true;
yoshiki 2013/09/09 08:16:54 nit: no need to set to true? I think either null o
hirono 2013/09/09 08:28:34 Done.
+ steps.run(function(nextStep) {
+ if (action != 'auto-open') {
yoshiki 2013/09/09 08:16:54 nit: Why we skip this step if 'auto-open'? Please
hirono 2013/09/09 08:28:34 Done.
+ nextStep();
+ return;
+ }
+ // If the disable-default-apps flag is on, Files.app is not opened
+ // automatically on device mount because it obstculs the manual test.
+ chrome.commandLinePrivate.hasSwitch('disable-default-apps',
+ function(flag) {
+ launchEnable = !flag;
+ nextStep();
+ });
+ });
+ steps.run(function() {
+ if (!launchEnable)
+ return;
yoshiki 2013/09/09 08:16:54 nit: add a blank line
hirono 2013/09/09 08:28:34 Done.
+ // Every other action opens a Files app window.
+ var appState = {
+ params: {
+ action: action
+ },
+ defaultPath: details.entries[0].fullPath
+ };
+ // For mounted devices just focus any Files.app window. The mounted
+ // volume will appear on the navigation list.
+ var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE :
+ LaunchType.FOCUS_SAME_OR_CREATE;
+ launchFileManager(appState,
+ undefined, // App ID.
+ type);
+ });
break;
}
}
-
/**
* @return {Object} Audio player window create options.
*/
« 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