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 var audioPlayerLaunchHandler = new AsyncUtil.Group(); |
|
mtomasz
2014/01/23 08:05:09
Please add comments, what's the purpose of it.
yoshiki
2014/01/24 15:34:19
Added a comment and changed the name of the variab
| |
| 671 * @type {Object} | 671 |
| 672 * @const | 672 chrome.commandLinePrivate.hasSwitch( |
|
mtomasz
2014/01/23 08:05:09
I think this is racy. launchAudioPlayer() may be c
yoshiki
2014/01/24 15:34:19
It won't be happened. In the case that the 'audioP
| |
| 673 */ | 673 'enable-new-audio-player', function(newAudioPlayerEnabled) { |
| 674 var AUDIO_PLAYER_CREATE_OPTIONS = Object.freeze({ | 674 var audioPlayerHTML = |
| 675 type: 'panel', | 675 newAudioPlayerEnabled ? 'audio_player.html' : 'mediaplayer.html'; |
| 676 hidden: true, | 676 |
| 677 minHeight: 35 + 58, | 677 /** |
| 678 minWidth: 280, | 678 * Audio player window create options. |
| 679 height: 35 + 58, | 679 * @type {Object} |
| 680 width: 280 | 680 */ |
| 681 var audioPlayerCreateOptions = Object.freeze({ | |
| 682 type: 'panel', | |
| 683 hidden: true, | |
| 684 minHeight: newAudioPlayerEnabled ? 116 : (35 + 58), | |
| 685 minWidth: newAudioPlayerEnabled ? 292 : 280, | |
| 686 height: newAudioPlayerEnabled ? 356 : (35 + 58), | |
| 687 width: newAudioPlayerEnabled ? 292 : 280, | |
| 688 }); | |
| 689 | |
| 690 audioPlayer = new SingletonAppWindowWrapper(audioPlayerHTML, | |
| 691 audioPlayerCreateOptions); | |
| 692 audioPlayerLaunchHandler.run(); | |
|
mtomasz
2014/01/23 08:05:09
Please add comments, this is not easy to understan
| |
| 693 audioPlayerLaunchHandler = null; | |
| 681 }); | 694 }); |
| 682 | 695 |
| 683 var audioPlayer = new SingletonAppWindowWrapper('mediaplayer.html', | |
| 684 AUDIO_PLAYER_CREATE_OPTIONS); | |
| 685 | |
| 686 /** | 696 /** |
| 687 * Launch the audio player. | 697 * Launch the audio player. |
| 688 * @param {Object} playlist Playlist. | 698 * @param {Object} playlist Playlist. |
| 689 */ | 699 */ |
| 690 function launchAudioPlayer(playlist) { | 700 function launchAudioPlayer(playlist) { |
| 691 audioPlayer.launch(playlist); | 701 if (audioPlayer) |
| 702 audioPlayer.launch(playlist); | |
| 703 else | |
| 704 audioPlayerLaunchHandler.add(launchAudioPlayer.bind(null, playlist)); | |
|
mtomasz
2014/01/23 08:05:09
What's the purpose of this group? Is it needed?
| |
| 692 } | 705 } |
| 693 | 706 |
| 694 var videoPlayer = new SingletonAppWindowWrapper('video_player.html', | 707 var videoPlayer = new SingletonAppWindowWrapper('video_player.html', |
| 695 {hidden: true}); | 708 {hidden: true}); |
| 696 | 709 |
| 697 /** | 710 /** |
| 698 * Launch the video player. | 711 * Launch the video player. |
| 699 * @param {string} url Video url. | 712 * @param {string} url Video url. |
| 700 */ | 713 */ |
| 701 function launchVideoPlayer(url) { | 714 function launchVideoPlayer(url) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 var appState = JSON.parse(items[key]); | 751 var appState = JSON.parse(items[key]); |
| 739 launchFileManager(appState, id); | 752 launchFileManager(appState, id); |
| 740 } catch (e) { | 753 } catch (e) { |
| 741 console.error('Corrupt launch data for ' + id); | 754 console.error('Corrupt launch data for ' + id); |
| 742 } | 755 } |
| 743 } | 756 } |
| 744 } | 757 } |
| 745 } | 758 } |
| 746 }); | 759 }); |
| 747 | 760 |
| 748 // Reopen sub-applications. | 761 // Reopen audio player. |
| 749 audioPlayer.reopen(); | 762 if (audioPlayer) |
| 763 audioPlayer.reopen(); | |
| 764 else | |
| 765 audioPlayerLaunchHandler.add(function() { audioPlayer.reopen(); }); | |
| 766 | |
| 767 // Reopen video player. | |
| 750 videoPlayer.reopen(); | 768 videoPlayer.reopen(); |
| 751 }; | 769 }; |
| 752 | 770 |
| 753 /** | 771 /** |
| 754 * Handles clicks on a custom item on the launcher context menu. | 772 * Handles clicks on a custom item on the launcher context menu. |
| 755 * @param {OnClickData} info Event details. | 773 * @param {OnClickData} info Event details. |
| 756 * @private | 774 * @private |
| 757 */ | 775 */ |
| 758 Background.prototype.onContextMenuClicked_ = function(info) { | 776 Background.prototype.onContextMenuClicked_ = function(info) { |
| 759 if (info.menuItemId == 'new-window') { | 777 if (info.menuItemId == 'new-window') { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 contexts: ['launcher'], | 814 contexts: ['launcher'], |
| 797 title: str('NEW_WINDOW_BUTTON_LABEL') | 815 title: str('NEW_WINDOW_BUTTON_LABEL') |
| 798 }); | 816 }); |
| 799 }; | 817 }; |
| 800 | 818 |
| 801 /** | 819 /** |
| 802 * Singleton instance of Background. | 820 * Singleton instance of Background. |
| 803 * @type {Background} | 821 * @type {Background} |
| 804 */ | 822 */ |
| 805 window.background = new Background(); | 823 window.background = new Background(); |
| OLD | NEW |