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

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

Issue 210623003: [VideoPlayer] Remove the old video player from Files.app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 * @private 683 * @private
684 */ 684 */
685 Background.prototype.onExecute_ = function(action, details) { 685 Background.prototype.onExecute_ = function(action, details) {
686 var urls = details.entries.map(function(e) { return e.toURL(); }); 686 var urls = details.entries.map(function(e) { return e.toURL(); });
687 687
688 switch (action) { 688 switch (action) {
689 case 'play': 689 case 'play':
690 launchAudioPlayer({items: urls, position: 0}); 690 launchAudioPlayer({items: urls, position: 0});
691 break; 691 break;
692 692
693 case 'watch':
694 launchVideoPlayer(urls[0]);
695 break;
696
697 default: 693 default:
698 var launchEnable = null; 694 var launchEnable = null;
699 var queue = new AsyncUtil.Queue(); 695 var queue = new AsyncUtil.Queue();
700 queue.run(function(nextStep) { 696 queue.run(function(nextStep) {
701 // If it is not auto-open (triggered by mounting external devices), we 697 // If it is not auto-open (triggered by mounting external devices), we
702 // always launch Files.app. 698 // always launch Files.app.
703 if (action != 'auto-open') { 699 if (action != 'auto-open') {
704 launchEnable = true; 700 launchEnable = true;
705 nextStep(); 701 nextStep();
706 return; 702 return;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 audioPlayerInitializationQueue.run(function(callback) { 792 audioPlayerInitializationQueue.run(function(callback) {
797 audioPlayer.launch(playlist, false, function(appWindow) { 793 audioPlayer.launch(playlist, false, function(appWindow) {
798 audioPlayer.setIcon(AUDIO_PLAYER_ICON); 794 audioPlayer.setIcon(AUDIO_PLAYER_ICON);
799 AppWindowWrapper.focusOnDesktop(audioPlayer.rawAppWindow, 795 AppWindowWrapper.focusOnDesktop(audioPlayer.rawAppWindow,
800 opt_displayedId); 796 opt_displayedId);
801 }); 797 });
802 callback(); 798 callback();
803 }); 799 });
804 } 800 }
805 801
806 var videoPlayer = new SingletonAppWindowWrapper('video_player.html',
807 {hidden: true});
808
809 /**
810 * Launches the video player.
811 * @param {string} url Video url.
812 * @param {string=} opt_displayedId ProfileID of the desktop where the video
813 * player should show.
814 */
815 function launchVideoPlayer(url, opt_displayedId) {
816 videoPlayer.launch({url: url}, false, function(appWindow) {
817 AppWindowWrapper.focusOnDesktop(videoPlayer.rawAppWindow, opt_displayedId);
818 });
819 }
820
821 /** 802 /**
822 * Launches the app. 803 * Launches the app.
823 * @private 804 * @private
824 */ 805 */
825 Background.prototype.onLaunched_ = function() { 806 Background.prototype.onLaunched_ = function() {
826 if (nextFileManagerWindowID == 0) { 807 if (nextFileManagerWindowID == 0) {
827 // The app just launched. Remove window state records that are not needed 808 // The app just launched. Remove window state records that are not needed
828 // any more. 809 // any more.
829 chrome.storage.local.get(function(items) { 810 chrome.storage.local.get(function(items) {
830 for (var key in items) { 811 for (var key in items) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 // Reopen audio player. 845 // Reopen audio player.
865 audioPlayerInitializationQueue.run(function(callback) { 846 audioPlayerInitializationQueue.run(function(callback) {
866 audioPlayer.reopen(function() { 847 audioPlayer.reopen(function() {
867 // If the audioPlayer is reopened, change its window's icon. Otherwise 848 // If the audioPlayer is reopened, change its window's icon. Otherwise
868 // there is no reopened window so just skip the call of setIcon. 849 // there is no reopened window so just skip the call of setIcon.
869 if (audioPlayer.rawAppWindow) 850 if (audioPlayer.rawAppWindow)
870 audioPlayer.setIcon(AUDIO_PLAYER_ICON); 851 audioPlayer.setIcon(AUDIO_PLAYER_ICON);
871 }); 852 });
872 callback(); 853 callback();
873 }); 854 });
874
875 // Reopen video player.
876 videoPlayer.reopen();
877 }; 855 };
878 856
879 /** 857 /**
880 * Handles clicks on a custom item on the launcher context menu. 858 * Handles clicks on a custom item on the launcher context menu.
881 * @param {OnClickData} info Event details. 859 * @param {OnClickData} info Event details.
882 * @private 860 * @private
883 */ 861 */
884 Background.prototype.onContextMenuClicked_ = function(info) { 862 Background.prototype.onContextMenuClicked_ = function(info) {
885 if (info.menuItemId == 'new-window') { 863 if (info.menuItemId == 'new-window') {
886 // Find the focused window (if any) and use it's current url for the 864 // Find the focused window (if any) and use it's current url for the
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 contexts: ['launcher'], 905 contexts: ['launcher'],
928 title: str('NEW_WINDOW_BUTTON_LABEL') 906 title: str('NEW_WINDOW_BUTTON_LABEL')
929 }); 907 });
930 }; 908 };
931 909
932 /** 910 /**
933 * Singleton instance of Background. 911 * Singleton instance of Background.
934 * @type {Background} 912 * @type {Background}
935 */ 913 */
936 window.background = new Background(); 914 window.background = new Background();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698