Chromium Code Reviews| 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 * Number of runtime errors catched in the background page. | 8 * Number of runtime errors catched in the background page. |
| 9 * @type {number} | 9 * @type {number} |
| 10 */ | 10 */ |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 // For mounted devices just focus any Files.app window. The mounted | 659 // For mounted devices just focus any Files.app window. The mounted |
| 660 // volume will appear on the navigation list. | 660 // volume will appear on the navigation list. |
| 661 var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE : | 661 var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE : |
| 662 LaunchType.FOCUS_SAME_OR_CREATE; | 662 LaunchType.FOCUS_SAME_OR_CREATE; |
| 663 launchFileManager(appState, /* App ID */ undefined, type, nextStep); | 663 launchFileManager(appState, /* App ID */ undefined, type, nextStep); |
| 664 }); | 664 }); |
| 665 break; | 665 break; |
| 666 } | 666 } |
| 667 }; | 667 }; |
| 668 | 668 |
| 669 /** | 669 var audioPlayer = null; |
| 670 * Audio player window create options. | 670 |
| 671 * @type {Object} | 671 // Stores closures to be executed after the initialization of the audio player |
|
mtomasz
2014/01/28 06:09:45
nit: Please update the comment.
yoshiki
2014/01/28 08:31:42
Done.
| |
| 672 * @const | 672 // is finished, not to use an audioPlayer object before initializiation. |
| 673 */ | 673 var audioPlayerInitializationQueue = new AsyncUtil.Queue(); |
| 674 var AUDIO_PLAYER_CREATE_OPTIONS = Object.freeze({ | 674 |
| 675 type: 'panel', | 675 audioPlayerInitializationQueue.run(function(callback) { |
| 676 hidden: true, | 676 chrome.commandLinePrivate.hasSwitch( |
| 677 minHeight: 35 + 58, | 677 'file-manager-enable-new-audio-player', |
| 678 minWidth: 280, | 678 function(newAudioPlayerEnabled) { |
| 679 height: 35 + 58, | 679 var audioPlayerHTML = |
| 680 width: 280 | 680 newAudioPlayerEnabled ? 'audio_player.html' : 'mediaplayer.html'; |
| 681 | |
| 682 /** | |
| 683 * Audio player window create options. | |
| 684 * @type {Object} | |
| 685 */ | |
| 686 var audioPlayerCreateOptions = Object.freeze({ | |
| 687 type: 'panel', | |
| 688 hidden: true, | |
| 689 minHeight: newAudioPlayerEnabled ? 116 : (35 + 58), | |
| 690 minWidth: newAudioPlayerEnabled ? 292 : 280, | |
| 691 height: newAudioPlayerEnabled ? 356 : (35 + 58), | |
| 692 width: newAudioPlayerEnabled ? 292 : 280, | |
| 693 }); | |
| 694 | |
| 695 audioPlayer = new SingletonAppWindowWrapper(audioPlayerHTML, | |
| 696 audioPlayerCreateOptions); | |
| 697 callback(); | |
| 698 }); | |
| 681 }); | 699 }); |
| 682 | 700 |
| 683 var audioPlayer = new SingletonAppWindowWrapper('mediaplayer.html', | |
| 684 AUDIO_PLAYER_CREATE_OPTIONS); | |
| 685 | |
| 686 /** | 701 /** |
| 687 * Launch the audio player. | 702 * Launch the audio player. |
| 688 * @param {Object} playlist Playlist. | 703 * @param {Object} playlist Playlist. |
| 689 */ | 704 */ |
| 690 function launchAudioPlayer(playlist) { | 705 function launchAudioPlayer(playlist) { |
| 691 audioPlayer.launch(playlist); | 706 audioPlayerInitializationQueue.run(function(callback) { |
| 707 audioPlayer.launch(playlist); | |
| 708 callback(); | |
| 709 }); | |
| 692 } | 710 } |
| 693 | 711 |
| 694 var videoPlayer = new SingletonAppWindowWrapper('video_player.html', | 712 var videoPlayer = new SingletonAppWindowWrapper('video_player.html', |
| 695 {hidden: true}); | 713 {hidden: true}); |
| 696 | 714 |
| 697 /** | 715 /** |
| 698 * Launch the video player. | 716 * Launch the video player. |
| 699 * @param {string} url Video url. | 717 * @param {string} url Video url. |
| 700 */ | 718 */ |
| 701 function launchVideoPlayer(url) { | 719 function launchVideoPlayer(url) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 var appState = JSON.parse(items[key]); | 756 var appState = JSON.parse(items[key]); |
| 739 launchFileManager(appState, id); | 757 launchFileManager(appState, id); |
| 740 } catch (e) { | 758 } catch (e) { |
| 741 console.error('Corrupt launch data for ' + id); | 759 console.error('Corrupt launch data for ' + id); |
| 742 } | 760 } |
| 743 } | 761 } |
| 744 } | 762 } |
| 745 } | 763 } |
| 746 }); | 764 }); |
| 747 | 765 |
| 748 // Reopen sub-applications. | 766 // Reopen audio player. |
| 749 audioPlayer.reopen(); | 767 audioPlayerInitializationQueue.run(function(callback) { |
| 768 audioPlayer.reopen(); | |
| 769 callback(); | |
| 770 }); | |
| 771 | |
| 772 // Reopen video player. | |
| 750 videoPlayer.reopen(); | 773 videoPlayer.reopen(); |
| 751 }; | 774 }; |
| 752 | 775 |
| 753 /** | 776 /** |
| 754 * Handles clicks on a custom item on the launcher context menu. | 777 * Handles clicks on a custom item on the launcher context menu. |
| 755 * @param {OnClickData} info Event details. | 778 * @param {OnClickData} info Event details. |
| 756 * @private | 779 * @private |
| 757 */ | 780 */ |
| 758 Background.prototype.onContextMenuClicked_ = function(info) { | 781 Background.prototype.onContextMenuClicked_ = function(info) { |
| 759 if (info.menuItemId == 'new-window') { | 782 if (info.menuItemId == 'new-window') { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 contexts: ['launcher'], | 819 contexts: ['launcher'], |
| 797 title: str('NEW_WINDOW_BUTTON_LABEL') | 820 title: str('NEW_WINDOW_BUTTON_LABEL') |
| 798 }); | 821 }); |
| 799 }; | 822 }; |
| 800 | 823 |
| 801 /** | 824 /** |
| 802 * Singleton instance of Background. | 825 * Singleton instance of Background. |
| 803 * @type {Background} | 826 * @type {Background} |
| 804 */ | 827 */ |
| 805 window.background = new Background(); | 828 window.background = new Background(); |
| OLD | NEW |