Commit 2c9c2952 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Add comments and Closure annotations from the JS fix for issue 831074

Issue 831074 was resolved with a C++ fix, but there was a JS fix patch
prior to that that also fixed the problem. It was abandoned [1] but it
contained useful new comments + Closure annotations. Let's use them.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1013823/18

Bug: 833834
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ic33a6f90ba99eedebc631dae09cb8bc45040fac9
Reviewed-on: https://chromium-review.googlesource.com/1014822Reviewed-by: default avatarTatsuhisa Yamaguchi <yamaguchi@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551581}
parent 603d31f2
...@@ -7,16 +7,22 @@ ...@@ -7,16 +7,22 @@
* TODO(yoshiki): Consider providing an exact size icon, instead of relying * TODO(yoshiki): Consider providing an exact size icon, instead of relying
* on downsampling by ash. * on downsampling by ash.
* *
* @type {string} * @type {!string}
* @const * @const
*/ */
var AUDIO_PLAYER_ICON = 'icons/audio-player-64.png'; var AUDIO_PLAYER_ICON = 'icons/audio-player-64.png';
/**
* HTML source of the audio player.
* @type {!string}
* @const
*/
var AUDIO_PLAYER_APP_URL = 'audio_player.html'; var AUDIO_PLAYER_APP_URL = 'audio_player.html';
/** /**
* Configuration of the audio player. * Configuration of the audio player.
* @type {Object} * @type {!Object}
* @const
*/ */
var audioPlayerCreateOptions = { var audioPlayerCreateOptions = {
id: 'audio-player', id: 'audio-player',
...@@ -40,7 +46,7 @@ function AudioPlayerBackground() { ...@@ -40,7 +46,7 @@ function AudioPlayerBackground() {
AudioPlayerBackground.prototype.__proto__ = BackgroundBase.prototype; AudioPlayerBackground.prototype.__proto__ = BackgroundBase.prototype;
/** /**
* Called when an app is restarted. * Called when an audio player app is restarted.
*/ */
AudioPlayerBackground.prototype.onRestarted_ = function() { AudioPlayerBackground.prototype.onRestarted_ = function() {
audioPlayer.reopen(function() { audioPlayer.reopen(function() {
...@@ -51,22 +57,21 @@ AudioPlayerBackground.prototype.onRestarted_ = function() { ...@@ -51,22 +57,21 @@ AudioPlayerBackground.prototype.onRestarted_ = function() {
}); });
}; };
/** /**
* Backgound object. This is necessary for AppWindowWrapper. * Backgound object. This is necessary for AppWindowWrapper.
* @type {BackgroundBase} * @type {!AudioPlayerBackground}
*/ */
var background = new AudioPlayerBackground(); var background = new AudioPlayerBackground();
/** /**
* Wrapper of audio player window. * Audio player app window wrapper.
* @type {SingletonAppWindowWrapper} * @type {!SingletonAppWindowWrapper}
*/ */
var audioPlayer = new SingletonAppWindowWrapper(AUDIO_PLAYER_APP_URL, var audioPlayer = new SingletonAppWindowWrapper(AUDIO_PLAYER_APP_URL,
audioPlayerCreateOptions); audioPlayerCreateOptions);
/** /**
* Opens player window. * Opens the audio player window.
* @param {!Array<string>} urls List of audios to play and index to start * @param {!Array<string>} urls List of audios to play and index to start
* playing. * playing.
* @return {!Promise} Promise to be fulfilled on success, or rejected on error. * @return {!Promise} Promise to be fulfilled on success, or rejected on error.
......
...@@ -90,7 +90,7 @@ function FileBrowserBackgroundImpl() { ...@@ -90,7 +90,7 @@ function FileBrowserBackgroundImpl() {
/** /**
* Provides drive search to app launcher. * Provides drive search to app launcher.
* @private {LauncherSearch} * @private {!LauncherSearch}
*/ */
this.launcherSearch_ = new LauncherSearch(); this.launcherSearch_ = new LauncherSearch();
...@@ -302,7 +302,7 @@ FileBrowserBackgroundImpl.prototype.navigateToVolumeInFocusedWindow_ = function( ...@@ -302,7 +302,7 @@ FileBrowserBackgroundImpl.prototype.navigateToVolumeInFocusedWindow_ = function(
/** /**
* Prefix for the dialog ID. * Prefix for the dialog ID.
* @type {string} * @type {!string}
* @const * @const
*/ */
var DIALOG_ID_PREFIX = 'dialog#'; var DIALOG_ID_PREFIX = 'dialog#';
...@@ -378,7 +378,7 @@ FileBrowserBackgroundImpl.prototype.onLaunched_ = function() { ...@@ -378,7 +378,7 @@ FileBrowserBackgroundImpl.prototype.onLaunched_ = function() {
}); });
}; };
/** @const {string} */ /** @const {!string} */
var GPLUS_PHOTOS_APP_ID = 'efjnaogkjbogokcnohkmnjdojkikgobo'; var GPLUS_PHOTOS_APP_ID = 'efjnaogkjbogokcnohkmnjdojkikgobo';
/** /**
...@@ -453,6 +453,7 @@ FileBrowserBackgroundImpl.prototype.onContextMenuClicked_ = function(info) { ...@@ -453,6 +453,7 @@ FileBrowserBackgroundImpl.prototype.onContextMenuClicked_ = function(info) {
* *
* @return {!Promise<?string>} Promise fulfilled with a key of the focused * @return {!Promise<?string>} Promise fulfilled with a key of the focused
* window, or null if not found. * window, or null if not found.
* @private
*/ */
FileBrowserBackgroundImpl.prototype.findFocusedWindow_ = function() { FileBrowserBackgroundImpl.prototype.findFocusedWindow_ = function() {
return new Promise(function(fulfill, reject) { return new Promise(function(fulfill, reject) {
...@@ -534,9 +535,13 @@ FileBrowserBackgroundImpl.prototype.initContextMenu_ = function() { ...@@ -534,9 +535,13 @@ FileBrowserBackgroundImpl.prototype.initContextMenu_ = function() {
}; };
/** /**
* Singleton instance of Background. * Singleton instance of Background object.
* NOTE: This must come after the call to metrics.clearUserId. * @type {!FileBrowserBackgroundImpl}
* @type {FileBrowserBackgroundImpl}
*/ */
window.background = new FileBrowserBackgroundImpl(); window.background = new FileBrowserBackgroundImpl();
/**
* Lastly, end recording of the background page Load.BackgroundScript metric.
* NOTE: This call must come after the call to metrics.clearUserId.
*/
metrics.recordInterval('Load.BackgroundScript'); metrics.recordInterval('Load.BackgroundScript');
...@@ -78,10 +78,10 @@ test.util.async = {}; ...@@ -78,10 +78,10 @@ test.util.async = {};
* @const * @const
*/ */
test.util.TESTING_EXTENSION_IDS = [ test.util.TESTING_EXTENSION_IDS = [
'oobinhbdbiehknkpbpejbbpdbkdjmoco', // File Manager test 'oobinhbdbiehknkpbpejbbpdbkdjmoco', // File Manager test extension.
'ejhcmmdhhpdhhgmifplfmjobgegbibkn', // Gallery test 'ejhcmmdhhpdhhgmifplfmjobgegbibkn', // Gallery test extension.
'ljoplibgfehghmibaoaepfagnmbbfiga', // Video Player test 'ljoplibgfehghmibaoaepfagnmbbfiga', // Video Player test extension.
'ddabbgbggambiildohfagdkliahiecfl', // Audio Player test 'ddabbgbggambiildohfagdkliahiecfl', // Audio Player test extension.
]; ];
/** /**
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
/** /**
* Configuration of the Gallery window. * Configuration of the Gallery window.
* @type {!Object}
* @const * @const
* @type {Object}
*/ */
var windowCreateOptions = { var windowCreateOptions = {
id: 'gallery', id: 'gallery',
...@@ -26,8 +26,8 @@ var windowCreateOptions = { ...@@ -26,8 +26,8 @@ var windowCreateOptions = {
var background = new BackgroundBase(); var background = new BackgroundBase();
/** /**
* Wrapper of gallery window. * Gallery app window wrapper.
* @type {SingletonAppWindowWrapper} * @type {!SingletonAppWindowWrapper}
*/ */
var gallery = new SingletonAppWindowWrapper('gallery.html', var gallery = new SingletonAppWindowWrapper('gallery.html',
windowCreateOptions); windowCreateOptions);
......
...@@ -7,14 +7,15 @@ ...@@ -7,14 +7,15 @@
* TODO(yoshiki): Consider providing an exact size icon, instead of relying * TODO(yoshiki): Consider providing an exact size icon, instead of relying
* on downsampling by ash. * on downsampling by ash.
* *
* @type {string} * @type {!string}
* @const * @const
*/ */
var ICON_IMAGE = 'images/icon/video-player-64.png'; var ICON_IMAGE = 'images/icon/video-player-64.png';
/** /**
* Configuration of the video player panel. * Configuration of the video player panel.
* @type {Object} * @type {!Object}
* @const
*/ */
var windowCreateOptions = { var windowCreateOptions = {
frame: { frame: {
...@@ -25,12 +26,16 @@ var windowCreateOptions = { ...@@ -25,12 +26,16 @@ var windowCreateOptions = {
}; };
/** /**
* Backgound object. This is necessary for AppWindowWrapper. * Backgound object.
* @type {BackgroundBase} * @type {!BackgroundBase}
*/ */
var background = new BackgroundBase(); var background = new BackgroundBase();
/**
* Creates a unique windowId string. Each call increments the sequence number
* used to create the string. The first call returns "VIDEO_PLAYER_APP_0".
* @return {String} windowId The windowId string.
*/
var generateWindowId = (function() { var generateWindowId = (function() {
var seq = 0; var seq = 0;
return function() { return function() {
...@@ -39,7 +44,7 @@ var generateWindowId = (function() { ...@@ -39,7 +44,7 @@ var generateWindowId = (function() {
}.wrap())(); }.wrap())();
/** /**
* Opens player window. * Opens the video player window.
* @param {!Array<string>} urls List of videos to play and index to start * @param {!Array<string>} urls List of videos to play and index to start
* playing. * playing.
* @return {!Promise} Promise to be fulfilled on success, or rejected on error. * @return {!Promise} Promise to be fulfilled on success, or rejected on error.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment