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

Side by Side Diff: components/chrome_apps/webstore_widget/app/main.js

Issue 1150173003: Fix some JS style nits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 //<include src="../../../../ui/webui/resources/js/cr.js"> 5 //<include src="../../../../ui/webui/resources/js/cr.js">
6 //<include src="../../../../ui/webui/resources/js/load_time_data.js"> 6 //<include src="../../../../ui/webui/resources/js/load_time_data.js">
7 //<include src="../../../../ui/webui/resources/js/i18n_template_no_process.js"> 7 //<include src="../../../../ui/webui/resources/js/i18n_template_no_process.js">
8 //<include src="../../../../ui/webui/resources/js/cr/event_target.js"> 8 //<include src="../../../../ui/webui/resources/js/cr/event_target.js">
9 //<include src="../../../../ui/webui/resources/js/cr/ui/dialogs.js"> 9 //<include src="../../../../ui/webui/resources/js/cr/ui/dialogs.js">
10 10
11 (function() { 11 (function() {
12 'use strict'; 12 'use strict';
13 13
14 //<include src="../cws_widget/app_installer.js"> 14 //<include src="../cws_widget/app_installer.js">
15 //<include src="../cws_widget/cws_webview_client.js"> 15 //<include src="../cws_widget/cws_webview_client.js">
16 //<include src="../cws_widget/cws_widget_container.js"> 16 //<include src="../cws_widget/cws_widget_container.js">
17 //<include src="../cws_widget/cws_widget_container_error_dialog.js"> 17 //<include src="../cws_widget/cws_widget_container_error_dialog.js">
18 18
19 /** 19 /**
20 * @type {?{ 20 * @type {?{
21 * filter: !Object.<string, *>, 21 * filter: !Object<string, *>,
22 * webstoreUrl: ?string 22 * webstoreUrl: ?string
23 * }} 23 * }}
24 */ 24 */
25 window.params = window.params || null; 25 window.params = window.params || null;
26 26
27 /** 27 /**
28 * @param {string} id Element id. 28 * @param {string} id Element id.
29 * @return {HTMLElement} The found element, or null. 29 * @return {HTMLElement} The found element, or null.
30 */ 30 */
31 function $(id) { 31 function $(id) {
(...skipping 14 matching lines...) Expand all
46 46
47 /** 47 /**
48 * @param {string} id The string id. 48 * @param {string} id The string id.
49 * @return {string} 49 * @return {string}
50 */ 50 */
51 function getString(id) { 51 function getString(id) {
52 return loadTimeData.getString(id) || defaultStrings[id] || ''; 52 return loadTimeData.getString(id) || defaultStrings[id] || '';
53 } 53 }
54 54
55 /** 55 /**
56 * @param {Object.<string, string>} strings Localized strings used by the 56 * @param {Object<string, string>} strings Localized strings used by the
57 * container. 57 * container.
58 * @return {!CWSWidgetContainer.PlatformDelegate} 58 * @return {!CWSWidgetContainer.PlatformDelegate}
59 */ 59 */
60 function createPlatformDelegate(strings) { 60 function createPlatformDelegate(strings) {
61 return { 61 return {
62 strings: { 62 strings: {
63 UI_LOCALE: getString('language'), 63 UI_LOCALE: getString('language'),
64 LINK_TO_WEBSTORE: getString('LINK_TO_WEBSTORE'), 64 LINK_TO_WEBSTORE: getString('LINK_TO_WEBSTORE'),
65 INSTALLATION_FAILED_MESSAGE: getString('INSTALLATION_FAILED_MESSAGE') 65 INSTALLATION_FAILED_MESSAGE: getString('INSTALLATION_FAILED_MESSAGE')
66 }, 66 },
(...skipping 24 matching lines...) Expand all
91 installWebstoreItem: function(itemId, callback) { 91 installWebstoreItem: function(itemId, callback) {
92 chrome.webstoreWidgetPrivate.installWebstoreItem( 92 chrome.webstoreWidgetPrivate.installWebstoreItem(
93 itemId, 93 itemId,
94 false, 94 false,
95 function() { 95 function() {
96 callback(chrome.runtime.lastError ? 96 callback(chrome.runtime.lastError ?
97 chrome.runtime.lastError.message || 'UNKNOWN_ERROR' : null); 97 chrome.runtime.lastError.message || 'UNKNOWN_ERROR' : null);
98 }); 98 });
99 }, 99 },
100 100
101 /** @param {function(Array.<string>)} callback */ 101 /** @param {function(Array<string>)} callback */
102 getInstalledItems: function(callback) { callback([]); }, 102 getInstalledItems: function(callback) { callback([]); },
103 103
104 /** 104 /**
105 * @param {function(?string)} callback The argument is the fetche3d access 105 * @param {function(?string)} callback The argument is the fetche3d access
106 * token. Null on error. 106 * token. Null on error.
107 */ 107 */
108 requestWebstoreAccessToken: function(callback) { 108 requestWebstoreAccessToken: function(callback) {
109 chrome.fileManagerPrivate.requestWebStoreAccessToken(function(token) { 109 chrome.fileManagerPrivate.requestWebStoreAccessToken(function(token) {
110 if (chrome.runtime.lastError) { 110 if (chrome.runtime.lastError) {
111 console.error('Error getting access token: ' + 111 console.error('Error getting access token: ' +
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 var result = widgetContainer.finalizeAndGetResult(); 204 var result = widgetContainer.finalizeAndGetResult();
205 showWidgetResult(result.result); 205 showWidgetResult(result.result);
206 }) 206 })
207 /** @param {*} error */ 207 /** @param {*} error */
208 .catch(function(error) { 208 .catch(function(error) {
209 showWidgetResult(CWSWidgetContainer.Result.FAILED); 209 showWidgetResult(CWSWidgetContainer.Result.FAILED);
210 }); 210 });
211 }); 211 });
212 }); 212 });
213 })(); 213 })();
OLDNEW
« no previous file with comments | « chrome/test/data/webui/test_api.js ('k') | components/chrome_apps/webstore_widget/cws_widget/cws_webview_client.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698