| 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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 }; | 684 }; |
| 685 | 685 |
| 686 // The instance of audio player. Until it's ready, this is null. | 686 // The instance of audio player. Until it's ready, this is null. |
| 687 var audioPlayer = null; | 687 var audioPlayer = null; |
| 688 | 688 |
| 689 // Queue to serializes the initialization, launching and reloading of the audio | 689 // Queue to serializes the initialization, launching and reloading of the audio |
| 690 // player, so races won't happen. | 690 // player, so races won't happen. |
| 691 var audioPlayerInitializationQueue = new AsyncUtil.Queue(); | 691 var audioPlayerInitializationQueue = new AsyncUtil.Queue(); |
| 692 | 692 |
| 693 audioPlayerInitializationQueue.run(function(callback) { | 693 audioPlayerInitializationQueue.run(function(callback) { |
| 694 // TODO(yoshiki): Remove '--file-manager-enable-new-audio-player' flag after | 694 chrome.commandLinePrivate.hasSwitch( |
| 695 // the feature is launched. | 695 'file-manager-enable-new-audio-player', |
| 696 var newAudioPlayerEnabled = true; | 696 function(newAudioPlayerEnabled) { |
| 697 var audioPlayerHTML = |
| 698 newAudioPlayerEnabled ? 'audio_player.html' : 'mediaplayer.html'; |
| 697 | 699 |
| 698 var audioPlayerHTML = | 700 /** |
| 699 newAudioPlayerEnabled ? 'audio_player.html' : 'mediaplayer.html'; | 701 * Audio player window create options. |
| 702 * @type {Object} |
| 703 */ |
| 704 var audioPlayerCreateOptions = Object.freeze({ |
| 705 type: 'panel', |
| 706 hidden: true, |
| 707 minHeight: newAudioPlayerEnabled ? 116 : (35 + 58), |
| 708 minWidth: newAudioPlayerEnabled ? 292 : 280, |
| 709 height: newAudioPlayerEnabled ? 356 : (35 + 58), |
| 710 width: newAudioPlayerEnabled ? 292 : 280, |
| 711 }); |
| 700 | 712 |
| 701 /** | 713 audioPlayer = new SingletonAppWindowWrapper(audioPlayerHTML, |
| 702 * Audio player window create options. | 714 audioPlayerCreateOptions); |
| 703 * @type {Object} | 715 callback(); |
| 704 */ | 716 }); |
| 705 var audioPlayerCreateOptions = Object.freeze({ | |
| 706 type: 'panel', | |
| 707 hidden: true, | |
| 708 minHeight: newAudioPlayerEnabled ? 116 : (35 + 58), | |
| 709 minWidth: newAudioPlayerEnabled ? 292 : 280, | |
| 710 height: newAudioPlayerEnabled ? 356 : (35 + 58), | |
| 711 width: newAudioPlayerEnabled ? 292 : 280, | |
| 712 }); | |
| 713 | |
| 714 audioPlayer = new SingletonAppWindowWrapper(audioPlayerHTML, | |
| 715 audioPlayerCreateOptions); | |
| 716 callback(); | |
| 717 }); | 717 }); |
| 718 | 718 |
| 719 /** | 719 /** |
| 720 * Launch the audio player. | 720 * Launch the audio player. |
| 721 * @param {Object} playlist Playlist. | 721 * @param {Object} playlist Playlist. |
| 722 */ | 722 */ |
| 723 function launchAudioPlayer(playlist) { | 723 function launchAudioPlayer(playlist) { |
| 724 audioPlayerInitializationQueue.run(function(callback) { | 724 audioPlayerInitializationQueue.run(function(callback) { |
| 725 audioPlayer.launch(playlist); | 725 audioPlayer.launch(playlist); |
| 726 callback(); | 726 callback(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 contexts: ['launcher'], | 838 contexts: ['launcher'], |
| 839 title: str('NEW_WINDOW_BUTTON_LABEL') | 839 title: str('NEW_WINDOW_BUTTON_LABEL') |
| 840 }); | 840 }); |
| 841 }; | 841 }; |
| 842 | 842 |
| 843 /** | 843 /** |
| 844 * Singleton instance of Background. | 844 * Singleton instance of Background. |
| 845 * @type {Background} | 845 * @type {Background} |
| 846 */ | 846 */ |
| 847 window.background = new Background(); | 847 window.background = new Background(); |
| OLD | NEW |