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

Side by Side Diff: chrome/browser/resources/settings/about_page/about_page_browser_proxy.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview A helper object used from the "About" section to interact with 6 * @fileoverview A helper object used from the "About" section to interact with
7 * the browser. 7 * the browser.
8 */ 8 */
9 9
10 <if expr="chromeos"> 10 /* <if expr="chromeos"> */
11 /** 11 /**
12 * @typedef {{ 12 * @typedef {{
13 * text: string, 13 * text: string,
14 * url: string, 14 * url: string,
15 * }} 15 * }}
16 */ 16 */
17 var RegulatoryInfo; 17 var RegulatoryInfo;
18 18
19 /** 19 /**
20 * @typedef {{ 20 * @typedef {{
(...skipping 15 matching lines...) Expand all
36 36
37 /** 37 /**
38 * Enumeration of all possible browser channels. 38 * Enumeration of all possible browser channels.
39 * @enum {string} 39 * @enum {string}
40 */ 40 */
41 var BrowserChannel = { 41 var BrowserChannel = {
42 BETA: 'beta-channel', 42 BETA: 'beta-channel',
43 DEV: 'dev-channel', 43 DEV: 'dev-channel',
44 STABLE: 'stable-channel', 44 STABLE: 'stable-channel',
45 }; 45 };
46 </if> 46 /* </if> */
47 47
48 /** 48 /**
49 * Enumeration of all possible update statuses. The string literals must match 49 * Enumeration of all possible update statuses. The string literals must match
50 * the ones defined at |AboutHandler::UpdateStatusToString|. 50 * the ones defined at |AboutHandler::UpdateStatusToString|.
51 * @enum {string} 51 * @enum {string}
52 */ 52 */
53 var UpdateStatus = { 53 var UpdateStatus = {
54 CHECKING: 'checking', 54 CHECKING: 'checking',
55 UPDATING: 'updating', 55 UPDATING: 'updating',
56 NEARLY_UPDATED: 'nearly_updated', 56 NEARLY_UPDATED: 'nearly_updated',
57 UPDATED: 'updated', 57 UPDATED: 'updated',
58 FAILED: 'failed', 58 FAILED: 'failed',
59 DISABLED: 'disabled', 59 DISABLED: 'disabled',
60 DISABLED_BY_ADMIN: 'disabled_by_admin', 60 DISABLED_BY_ADMIN: 'disabled_by_admin',
61 }; 61 };
62 62
63 <if expr="_google_chrome and is_macosx"> 63 /* <if expr="_google_chrome and is_macosx"> */
64 /** 64 /**
65 * @typedef {{ 65 * @typedef {{
66 * hidden: boolean, 66 * hidden: boolean,
67 * disabled: boolean, 67 * disabled: boolean,
68 * actionable: boolean, 68 * actionable: boolean,
69 * text: (string|undefined) 69 * text: (string|undefined)
70 * }} 70 * }}
71 */ 71 */
72 var PromoteUpdaterStatus; 72 var PromoteUpdaterStatus;
73 </if> 73 /* </if> */
74 74
75 /** 75 /**
76 * @typedef {{ 76 * @typedef {{
77 * status: !UpdateStatus, 77 * status: !UpdateStatus,
78 * progress: (number|undefined), 78 * progress: (number|undefined),
79 * message: (string|undefined), 79 * message: (string|undefined),
80 * }} 80 * }}
81 */ 81 */
82 var UpdateStatusChangedEvent; 82 var UpdateStatusChangedEvent;
83 83
84 cr.define('settings', function() { 84 cr.define('settings', function() {
85 /** 85 /**
86 * @param {!BrowserChannel} channel 86 * @param {!BrowserChannel} channel
87 * @return {string} 87 * @return {string}
88 */ 88 */
89 function browserChannelToI18nId(channel) { 89 function browserChannelToI18nId(channel) {
90 switch (channel) { 90 switch (channel) {
91 case BrowserChannel.BETA: return 'aboutChannelBeta'; 91 case BrowserChannel.BETA:
92 case BrowserChannel.DEV: return 'aboutChannelDev'; 92 return 'aboutChannelBeta';
93 case BrowserChannel.STABLE: return 'aboutChannelStable'; 93 case BrowserChannel.DEV:
94 return 'aboutChannelDev';
95 case BrowserChannel.STABLE:
96 return 'aboutChannelStable';
94 } 97 }
95 98
96 assertNotReached(); 99 assertNotReached();
97 } 100 }
98 101
99 /** 102 /**
100 * @param {!BrowserChannel} currentChannel 103 * @param {!BrowserChannel} currentChannel
101 * @param {!BrowserChannel} targetChannel 104 * @param {!BrowserChannel} targetChannel
102 * @return {boolean} Whether the target channel is more stable than the 105 * @return {boolean} Whether the target channel is more stable than the
103 * current channel. 106 * current channel.
(...skipping 21 matching lines...) Expand all
125 128
126 /** 129 /**
127 * Request update status from the browser. It results in one or more 130 * Request update status from the browser. It results in one or more
128 * 'update-status-changed' WebUI events. 131 * 'update-status-changed' WebUI events.
129 */ 132 */
130 refreshUpdateStatus: function() {}, 133 refreshUpdateStatus: function() {},
131 134
132 /** Opens the help page. */ 135 /** Opens the help page. */
133 openHelpPage: function() {}, 136 openHelpPage: function() {},
134 137
135 <if expr="_google_chrome"> 138 /* <if expr="_google_chrome"> */
136 /** 139 /**
137 * Opens the feedback dialog. 140 * Opens the feedback dialog.
138 */ 141 */
139 openFeedbackDialog: function() {}, 142 openFeedbackDialog: function() {},
140 </if> 143 /* </if> */
141 144
142 <if expr="chromeos"> 145 /* <if expr="chromeos"> */
143 /** 146 /**
144 * Checks for available update and applies if it exists. 147 * Checks for available update and applies if it exists.
145 */ 148 */
146 requestUpdate: function() {}, 149 requestUpdate: function() {},
147 150
148 /** 151 /**
149 * @param {!BrowserChannel} channel 152 * @param {!BrowserChannel} channel
150 * @param {boolean} isPowerwashAllowed 153 * @param {boolean} isPowerwashAllowed
151 */ 154 */
152 setChannel: function(channel, isPowerwashAllowed) {}, 155 setChannel: function(channel, isPowerwashAllowed) {},
153 156
154 /** @return {!Promise<!ChannelInfo>} */ 157 /** @return {!Promise<!ChannelInfo>} */
155 getChannelInfo: function() {}, 158 getChannelInfo: function() {},
156 159
157 /** @return {!Promise<!VersionInfo>} */ 160 /** @return {!Promise<!VersionInfo>} */
158 getVersionInfo: function() {}, 161 getVersionInfo: function() {},
159 162
160 /** @return {!Promise<?RegulatoryInfo>} */ 163 /** @return {!Promise<?RegulatoryInfo>} */
161 getRegulatoryInfo: function() {}, 164 getRegulatoryInfo: function() {},
162 </if> 165 /* </if> */
163 166
164 <if expr="_google_chrome and is_macosx"> 167 /* <if expr="_google_chrome and is_macosx"> */
165 /** 168 /**
166 * Triggers setting up auto-updates for all users. 169 * Triggers setting up auto-updates for all users.
167 */ 170 */
168 promoteUpdater: function() {}, 171 promoteUpdater: function() {},
169 </if> 172 /* </if> */
170 }; 173 };
171 174
172 /** 175 /**
173 * @implements {settings.AboutPageBrowserProxy} 176 * @implements {settings.AboutPageBrowserProxy}
174 * @constructor 177 * @constructor
175 */ 178 */
176 function AboutPageBrowserProxyImpl() {} 179 function AboutPageBrowserProxyImpl() {}
177 cr.addSingletonGetter(AboutPageBrowserProxyImpl); 180 cr.addSingletonGetter(AboutPageBrowserProxyImpl);
178 181
179 AboutPageBrowserProxyImpl.prototype = { 182 AboutPageBrowserProxyImpl.prototype = {
180 /** @override */ 183 /** @override */
181 pageReady: function() { 184 pageReady: function() {
182 chrome.send('aboutPageReady'); 185 chrome.send('aboutPageReady');
183 }, 186 },
184 187
185 /** @override */ 188 /** @override */
186 refreshUpdateStatus: function() { 189 refreshUpdateStatus: function() {
187 chrome.send('refreshUpdateStatus'); 190 chrome.send('refreshUpdateStatus');
188 }, 191 },
189 192
190 <if expr="_google_chrome and is_macosx"> 193 /* <if expr="_google_chrome and is_macosx"> */
191 /** @override */ 194 /** @override */
192 promoteUpdater: function() { 195 promoteUpdater: function() {
193 chrome.send('promoteUpdater'); 196 chrome.send('promoteUpdater');
194 }, 197 },
195 </if> 198 /* </if> */
196 199
197 /** @override */ 200 /** @override */
198 openHelpPage: function() { 201 openHelpPage: function() {
199 chrome.send('openHelpPage'); 202 chrome.send('openHelpPage');
200 }, 203 },
201 204
202 <if expr="_google_chrome"> 205 /* <if expr="_google_chrome"> */
203 /** @override */ 206 /** @override */
204 openFeedbackDialog: function() { 207 openFeedbackDialog: function() {
205 chrome.send('openFeedbackDialog'); 208 chrome.send('openFeedbackDialog');
206 }, 209 },
207 </if> 210 /* </if> */
208 211
209 <if expr="chromeos"> 212 /* <if expr="chromeos"> */
210 /** @override */ 213 /** @override */
211 requestUpdate: function() { 214 requestUpdate: function() {
212 chrome.send('requestUpdate'); 215 chrome.send('requestUpdate');
213 }, 216 },
214 217
215 /** @override */ 218 /** @override */
216 setChannel: function(channel, isPowerwashAllowed) { 219 setChannel: function(channel, isPowerwashAllowed) {
217 chrome.send('setChannel', [channel, isPowerwashAllowed]); 220 chrome.send('setChannel', [channel, isPowerwashAllowed]);
218 }, 221 },
219 222
220 /** @override */ 223 /** @override */
221 getChannelInfo: function() { 224 getChannelInfo: function() {
222 return cr.sendWithPromise('getChannelInfo'); 225 return cr.sendWithPromise('getChannelInfo');
223 }, 226 },
224 227
225 /** @override */ 228 /** @override */
226 getVersionInfo: function() { 229 getVersionInfo: function() {
227 return cr.sendWithPromise('getVersionInfo'); 230 return cr.sendWithPromise('getVersionInfo');
228 }, 231 },
229 232
230 /** @override */ 233 /** @override */
231 getRegulatoryInfo: function() { 234 getRegulatoryInfo: function() {
232 return cr.sendWithPromise('getRegulatoryInfo'); 235 return cr.sendWithPromise('getRegulatoryInfo');
233 } 236 }
234 </if> 237 /* </if> */
235 }; 238 };
236 239
237 return { 240 return {
238 AboutPageBrowserProxy: AboutPageBrowserProxy, 241 AboutPageBrowserProxy: AboutPageBrowserProxy,
239 AboutPageBrowserProxyImpl: AboutPageBrowserProxyImpl, 242 AboutPageBrowserProxyImpl: AboutPageBrowserProxyImpl,
240 browserChannelToI18nId: browserChannelToI18nId, 243 browserChannelToI18nId: browserChannelToI18nId,
241 isTargetChannelMoreStable: isTargetChannelMoreStable, 244 isTargetChannelMoreStable: isTargetChannelMoreStable,
242 }; 245 };
243 }); 246 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698