OLD | NEW |
---|---|
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 Loading... | |
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 = 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.
| |
407 params: { | 407 steps.run(function(nextStep) { |
408 action: action | 408 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.
| |
409 }, | 409 nextStep(); |
410 defaultPath: details.entries[0].fullPath, | 410 return; |
411 }; | 411 } |
412 // For mounted devices just focus any Files.app window. The mounted | 412 // If the disable-default-apps flag is on, Files.app is not opened |
413 // volume will appear on the navigation list. | 413 // automatically on device mount because it obstculs the manual test. |
414 var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE : | 414 chrome.commandLinePrivate.hasSwitch('disable-default-apps', |
415 LaunchType.FOCUS_SAME_OR_CREATE; | 415 function(flag) { |
416 launchFileManager(appState, | 416 launchEnable = !flag; |
417 undefined, // App ID. | 417 nextStep(); |
418 type); | 418 }); |
419 }); | |
420 steps.run(function() { | |
421 if (!launchEnable) | |
422 return; | |
yoshiki
2013/09/09 08:16:54
nit: add a blank line
hirono
2013/09/09 08:28:34
Done.
| |
423 // Every other action opens a Files app window. | |
424 var appState = { | |
425 params: { | |
426 action: action | |
427 }, | |
428 defaultPath: details.entries[0].fullPath | |
429 }; | |
430 // For mounted devices just focus any Files.app window. The mounted | |
431 // volume will appear on the navigation list. | |
432 var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE : | |
433 LaunchType.FOCUS_SAME_OR_CREATE; | |
434 launchFileManager(appState, | |
435 undefined, // App ID. | |
436 type); | |
437 }); | |
419 break; | 438 break; |
420 } | 439 } |
421 } | 440 } |
422 | 441 |
423 | |
424 /** | 442 /** |
425 * @return {Object} Audio player window create options. | 443 * @return {Object} Audio player window create options. |
426 */ | 444 */ |
427 function createAudioPlayerOptions() { | 445 function createAudioPlayerOptions() { |
428 var WIDTH = 280; | 446 var WIDTH = 280; |
429 var HEIGHT = 35 + 58; | 447 var HEIGHT = 35 + 58; |
430 return { | 448 return { |
431 type: 'panel', | 449 type: 'panel', |
432 hidden: true, | 450 hidden: true, |
433 minHeight: HEIGHT, | 451 minHeight: HEIGHT, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 queue.run(function(callback) { | 577 queue.run(function(callback) { |
560 chrome.fileBrowserPrivate.getStrings(function(strings) { | 578 chrome.fileBrowserPrivate.getStrings(function(strings) { |
561 initContextMenu(strings); | 579 initContextMenu(strings); |
562 chrome.storage.local.set({strings: strings}, callback); | 580 chrome.storage.local.set({strings: strings}, callback); |
563 }); | 581 }); |
564 }); | 582 }); |
565 } | 583 } |
566 | 584 |
567 // Initialize Files.app. | 585 // Initialize Files.app. |
568 initApp(); | 586 initApp(); |
OLD | NEW |