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

Side by Side 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: Address the comments. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Map of all currently open app window. The key is an app id. 8 * Map of all currently open app window. The key is an app id.
9 */ 9 */
10 var appWindows = {}; 10 var appWindows = {};
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 }); 383 });
384 } 384 }
385 385
386 /** 386 /**
387 * Executes a file browser task. 387 * Executes a file browser task.
388 * 388 *
389 * @param {string} action Task id. 389 * @param {string} action Task id.
390 * @param {Object} details Details object. 390 * @param {Object} details Details object.
391 */ 391 */
392 function onExecute(action, details) { 392 function onExecute(action, details) {
393 var urls = details.entries.map(function(e) { return e.toURL() }); 393 var urls = details.entries.map(function(e) { return e.toURL(); });
394 394
395 switch (action) { 395 switch (action) {
396 case 'play': 396 case 'play':
397 launchAudioPlayer({items: urls, position: 0}); 397 launchAudioPlayer({items: urls, position: 0});
398 break; 398 break;
399 399
400 case 'watch': 400 case 'watch':
401 launchVideoPlayer(urls[0]); 401 launchVideoPlayer(urls[0]);
402 break; 402 break;
403 403
404 default: 404 default:
405 // Every other action opens a Files app window. 405 var steps = new AsyncUtil.Queue();
406 var appState = { 406 var launchEnable = null;
407 params: { 407 steps.run(function(nextStep) {
408 action: action 408 // If it is not auto-open (triggered by mounting external devices), we
409 }, 409 // always launch Files.app.
410 defaultPath: details.entries[0].fullPath, 410 if (action != 'auto-open') {
411 }; 411 launchEnable = true;
412 // For mounted devices just focus any Files.app window. The mounted 412 nextStep();
413 // volume will appear on the navigation list. 413 return;
414 var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE : 414 }
415 LaunchType.FOCUS_SAME_OR_CREATE; 415 // If the disable-default-apps flag is on, Files.app is not opened
416 launchFileManager(appState, 416 // automatically on device mount because it obstculs the manual test.
417 undefined, // App ID. 417 chrome.commandLinePrivate.hasSwitch('disable-default-apps',
418 type); 418 function(flag) {
419 launchEnable = !flag;
420 nextStep();
421 });
422 });
423 steps.run(function() {
424 if (!launchEnable)
425 return;
426
427 // Every other action opens a Files app window.
428 var appState = {
429 params: {
430 action: action
431 },
432 defaultPath: details.entries[0].fullPath
433 };
434 // For mounted devices just focus any Files.app window. The mounted
435 // volume will appear on the navigation list.
436 var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE :
437 LaunchType.FOCUS_SAME_OR_CREATE;
438 launchFileManager(appState,
439 undefined, // App ID.
440 type);
441 });
419 break; 442 break;
420 } 443 }
421 } 444 }
422 445
423
424 /** 446 /**
425 * @return {Object} Audio player window create options. 447 * @return {Object} Audio player window create options.
426 */ 448 */
427 function createAudioPlayerOptions() { 449 function createAudioPlayerOptions() {
428 var WIDTH = 280; 450 var WIDTH = 280;
429 var HEIGHT = 35 + 58; 451 var HEIGHT = 35 + 58;
430 return { 452 return {
431 type: 'panel', 453 type: 'panel',
432 hidden: true, 454 hidden: true,
433 minHeight: HEIGHT, 455 minHeight: HEIGHT,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 queue.run(function(callback) { 581 queue.run(function(callback) {
560 chrome.fileBrowserPrivate.getStrings(function(strings) { 582 chrome.fileBrowserPrivate.getStrings(function(strings) {
561 initContextMenu(strings); 583 initContextMenu(strings);
562 chrome.storage.local.set({strings: strings}, callback); 584 chrome.storage.local.set({strings: strings}, callback);
563 }); 585 });
564 }); 586 });
565 } 587 }
566 588
567 // Initialize Files.app. 589 // Initialize Files.app.
568 initApp(); 590 initApp();
OLDNEW
« 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