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

Side by Side Diff: chrome/browser/resources/file_manager/background/js/background.js

Issue 144883002: [Files.app] Initial implementation of new audio player (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make the script/css files flattened. Created 6 years, 10 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
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 * 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // For mounted devices just focus any Files.app window. The mounted 676 // For mounted devices just focus any Files.app window. The mounted
677 // volume will appear on the navigation list. 677 // volume will appear on the navigation list.
678 var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE : 678 var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE :
679 LaunchType.FOCUS_SAME_OR_CREATE; 679 LaunchType.FOCUS_SAME_OR_CREATE;
680 launchFileManager(appState, /* App ID */ undefined, type, nextStep); 680 launchFileManager(appState, /* App ID */ undefined, type, nextStep);
681 }); 681 });
682 break; 682 break;
683 } 683 }
684 }; 684 };
685 685
686 /** 686 // The instance of audio player. Until it's ready, this is null.
687 * Audio player window create options. 687 var audioPlayer = null;
688 * @type {Object} 688
689 * @const 689 // Queue to serializes the initialization, launching and reloading of the audio
690 */ 690 // player, so races won't happen.
691 var AUDIO_PLAYER_CREATE_OPTIONS = Object.freeze({ 691 var audioPlayerInitializationQueue = new AsyncUtil.Queue();
692 type: 'panel', 692
693 hidden: true, 693 audioPlayerInitializationQueue.run(function(callback) {
694 minHeight: 35 + 58, 694 chrome.commandLinePrivate.hasSwitch(
695 minWidth: 280, 695 'file-manager-enable-new-audio-player',
696 height: 35 + 58, 696 function(newAudioPlayerEnabled) {
697 width: 280 697 var audioPlayerHTML =
698 newAudioPlayerEnabled ? 'audio_player.html' : 'mediaplayer.html';
699
700 /**
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 });
712
713 audioPlayer = new SingletonAppWindowWrapper(audioPlayerHTML,
714 audioPlayerCreateOptions);
715 callback();
716 });
698 }); 717 });
699 718
700 var audioPlayer = new SingletonAppWindowWrapper('mediaplayer.html',
701 AUDIO_PLAYER_CREATE_OPTIONS);
702
703 /** 719 /**
704 * Launch the audio player. 720 * Launch the audio player.
705 * @param {Object} playlist Playlist. 721 * @param {Object} playlist Playlist.
706 */ 722 */
707 function launchAudioPlayer(playlist) { 723 function launchAudioPlayer(playlist) {
708 audioPlayer.launch(playlist); 724 audioPlayerInitializationQueue.run(function(callback) {
725 audioPlayer.launch(playlist);
726 callback();
727 });
709 } 728 }
710 729
711 var videoPlayer = new SingletonAppWindowWrapper('video_player.html', 730 var videoPlayer = new SingletonAppWindowWrapper('video_player.html',
712 {hidden: true}); 731 {hidden: true});
713 732
714 /** 733 /**
715 * Launch the video player. 734 * Launch the video player.
716 * @param {string} url Video url. 735 * @param {string} url Video url.
717 */ 736 */
718 function launchVideoPlayer(url) { 737 function launchVideoPlayer(url) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 var appState = JSON.parse(items[key]); 774 var appState = JSON.parse(items[key]);
756 launchFileManager(appState, id); 775 launchFileManager(appState, id);
757 } catch (e) { 776 } catch (e) {
758 console.error('Corrupt launch data for ' + id); 777 console.error('Corrupt launch data for ' + id);
759 } 778 }
760 } 779 }
761 } 780 }
762 } 781 }
763 }); 782 });
764 783
765 // Reopen sub-applications. 784 // Reopen audio player.
766 audioPlayer.reopen(); 785 audioPlayerInitializationQueue.run(function(callback) {
786 audioPlayer.reopen();
787 callback();
788 });
789
790 // Reopen video player.
767 videoPlayer.reopen(); 791 videoPlayer.reopen();
768 }; 792 };
769 793
770 /** 794 /**
771 * Handles clicks on a custom item on the launcher context menu. 795 * Handles clicks on a custom item on the launcher context menu.
772 * @param {OnClickData} info Event details. 796 * @param {OnClickData} info Event details.
773 * @private 797 * @private
774 */ 798 */
775 Background.prototype.onContextMenuClicked_ = function(info) { 799 Background.prototype.onContextMenuClicked_ = function(info) {
776 if (info.menuItemId == 'new-window') { 800 if (info.menuItemId == 'new-window') {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 contexts: ['launcher'], 838 contexts: ['launcher'],
815 title: str('NEW_WINDOW_BUTTON_LABEL') 839 title: str('NEW_WINDOW_BUTTON_LABEL')
816 }); 840 });
817 }; 841 };
818 842
819 /** 843 /**
820 * Singleton instance of Background. 844 * Singleton instance of Background.
821 * @type {Background} 845 * @type {Background}
822 */ 846 */
823 window.background = new Background(); 847 window.background = new Background();
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/audio_player/js/audio_player_scripts.js ('k') | chromeos/chromeos_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698