From c3dc4adcbc89aef1f7b85b5b87086bbcbee2443b Mon Sep 17 00:00:00 2001 From: yawano Date: Mon, 12 Jan 2015 18:29:34 -0800 Subject: [PATCH] Add type annotations to video player. BUG=444485 TEST=GYP_GENERATORS=ninja tools/gyp/gyp --depth . ui/file_manager/video_player/js/compiled_resources.gyp && ninja -C out/Default Review URL: https://codereview.chromium.org/838963002 Cr-Commit-Position: refs/heads/master@{#311184} --- ui/file_manager/video_player/js/background.js | 4 ++-- ui/file_manager/video_player/js/compiled_resources.gyp | 7 +++++++ ui/file_manager/video_player/js/error_util.js | 2 +- ui/file_manager/video_player/js/test_util.js | 2 +- ui/file_manager/video_player/js/video_player_metrics.js | 6 +++--- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ui/file_manager/video_player/js/background.js b/ui/file_manager/video_player/js/background.js index 4e365a765352..ff44213f2e3c 100644 --- a/ui/file_manager/video_player/js/background.js +++ b/ui/file_manager/video_player/js/background.js @@ -120,8 +120,8 @@ function openVideoPlayerWindow(playlist, reopen) { return new Promise(function(fulfill, reject) { var urls = util.entriesToURLs(entries); var videoPlayer = new AppWindowWrapper('video_player.html', - generateWindowId(), - windowCreateOptions); + generateWindowId(), + windowCreateOptions); videoPlayer.launch( {items: urls, position: position}, diff --git a/ui/file_manager/video_player/js/compiled_resources.gyp b/ui/file_manager/video_player/js/compiled_resources.gyp index 37016de22a5d..0194d8b2dc52 100644 --- a/ui/file_manager/video_player/js/compiled_resources.gyp +++ b/ui/file_manager/video_player/js/compiled_resources.gyp @@ -7,16 +7,21 @@ 'target_name': 'background', 'variables': { 'depends': [ + '../../../../third_party/jstemplate/compiled_resources.gyp:jstemplate', '../../../webui/resources/js/cr.js', '../../../webui/resources/js/cr/event_target.js', '../../../webui/resources/js/cr/ui.js', '../../../webui/resources/js/cr/ui/array_data_model.js', + # Referenced in common/js/util.js. + '../../../webui/resources/js/cr/ui/dialogs.js', '../../../webui/resources/js/load_time_data.js', '../../../webui/resources/js/util.js', '../../file_manager/common/js/util.js', '../../file_manager/common/js/async_util.js', '../../file_manager/common/js/file_type.js', '../../file_manager/common/js/volume_manager_common.js', + '../../file_manager/background/js/app_window_wrapper.js', + '../../file_manager/background/js/background_base.js', '../../file_manager/background/js/volume_manager.js', 'error_util.js', 'test_util.js', @@ -25,6 +30,8 @@ '<(CLOSURE_DIR)/externs/chrome_send_externs.js', '<(CLOSURE_DIR)/externs/chrome_extensions.js', '<(CLOSURE_DIR)/externs/file_manager_private.js', + '../../externs/chrome_test.js', + '../../externs/platform.js', ], }, 'includes': [ diff --git a/ui/file_manager/video_player/js/error_util.js b/ui/file_manager/video_player/js/error_util.js index 5780dd51192f..c74f07b51de4 100644 --- a/ui/file_manager/video_player/js/error_util.js +++ b/ui/file_manager/video_player/js/error_util.js @@ -21,7 +21,7 @@ window.onerror = function() { window.JSErrorCount++; }; * * @param {Object=} opt_thisObject Object to be used as this. * @param {...} var_args Arguments to be bound with the wrapped function. - * @return {function} Wrapped function. + * @return {function(...)} Wrapped function. */ Function.prototype.wrap = function(opt_thisObject, var_args) { var func = this; diff --git a/ui/file_manager/video_player/js/test_util.js b/ui/file_manager/video_player/js/test_util.js index 2bfdc7f11cc9..d2f014db5415 100644 --- a/ui/file_manager/video_player/js/test_util.js +++ b/ui/file_manager/video_player/js/test_util.js @@ -56,7 +56,7 @@ test.util.sync.isPlaying = function(contentWindow) { * @return {number} Error count. */ test.util.sync.getErrorCount = function() { - var totalCount = JSErrorCount; + var totalCount = window.JSErrorCount; for (var appId in appWindowsForTest) { var contentWindow = appWindowsForTest[appId].contentWindow; if (contentWindow.JSErrorCount) diff --git a/ui/file_manager/video_player/js/video_player_metrics.js b/ui/file_manager/video_player/js/video_player_metrics.js index 2e62788bfc87..d49ddd6528ce 100644 --- a/ui/file_manager/video_player/js/video_player_metrics.js +++ b/ui/file_manager/video_player/js/video_player_metrics.js @@ -45,9 +45,9 @@ metrics.PLAY_TYPE = { /** * Utility function to check if the given value is in the given values. - * @param {Object} values + * @param {!Object} values * @param {*} value - * @reutrn {boolean} True if one or more elements of the given values hash have + * @return {boolean} True if one or more elements of the given values hash have * the given value as value. False otherwise. */ metrics.hasValue_ = function(values, value) { @@ -115,7 +115,7 @@ metrics.recordOpenVideoPlayerAction = function() { */ metrics.recordPlayType = function(type) { if (!metrics.hasValue_(metrics.PLAY_TYPE, type)) { - console.error('The given value "' + status + '" is invalid.'); + console.error('The given value "' + type + '" is invalid.'); return; } -- 2.11.4.GIT