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

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

Issue 2698133003: MD Settings: About: Show connectionTypes message (Closed)
Patch Set: Build HTML in the JS instead of using multiple vars Created 3 years, 10 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 'settings-about-page' contains version and OS related 6 * @fileoverview 'settings-about-page' contains version and OS related
7 * information. 7 * information.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-about-page', 10 is: 'settings-about-page',
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // </if> 253 // </if>
254 return this.i18n('aboutUpgradeRelaunch'); 254 return this.i18n('aboutUpgradeRelaunch');
255 case UpdateStatus.UPDATED: 255 case UpdateStatus.UPDATED:
256 return this.i18n('aboutUpgradeUpToDate'); 256 return this.i18n('aboutUpgradeUpToDate');
257 case UpdateStatus.UPDATING: 257 case UpdateStatus.UPDATING:
258 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); 258 assert(typeof this.currentUpdateStatusEvent_.progress == 'number');
259 var progressPercent = this.currentUpdateStatusEvent_.progress + '%'; 259 var progressPercent = this.currentUpdateStatusEvent_.progress + '%';
260 260
261 // <if expr="chromeos"> 261 // <if expr="chromeos">
262 if (this.currentChannel_ != this.targetChannel_) { 262 if (this.currentChannel_ != this.targetChannel_) {
263 return this.i18n('aboutUpgradeUpdatingChannelSwitch', 263 return this.i18n(
264 'aboutUpgradeUpdatingChannelSwitch',
264 this.i18n(settings.browserChannelToI18nId(this.targetChannel_)), 265 this.i18n(settings.browserChannelToI18nId(this.targetChannel_)),
265 progressPercent); 266 progressPercent);
266 } 267 }
267 // </if> 268 // </if>
268 if (this.currentUpdateStatusEvent_.progress > 0) { 269 if (this.currentUpdateStatusEvent_.progress > 0) {
269 // NOTE(dbeam): some platforms (i.e. Mac) always send 0% while 270 // NOTE(dbeam): some platforms (i.e. Mac) always send 0% while
270 // updating (they don't support incremental upgrade progress). Though 271 // updating (they don't support incremental upgrade progress). Though
271 // it's certainly quite possible to validly end up here with 0% on 272 // it's certainly quite possible to validly end up here with 0% on
272 // platforms that support incremental progress, nobody really likes 273 // platforms that support incremental progress, nobody really likes
273 // seeing that they're 0% done with something. 274 // seeing that they're 0% done with something.
274 return this.i18n('aboutUpgradeUpdatingPercent', progressPercent); 275 return this.i18n('aboutUpgradeUpdatingPercent', progressPercent);
275 } 276 }
276 return this.i18n('aboutUpgradeUpdating'); 277 return this.i18n('aboutUpgradeUpdating');
277 default: 278 default:
279 var result = '';
278 var message = this.currentUpdateStatusEvent_.message; 280 var message = this.currentUpdateStatusEvent_.message;
279 return message ? 281 if (!!message) {
280 parseHtmlSubset('<b>' + message + '</b>').firstChild.innerHTML : 282 result += '<div>' +
281 ''; 283 parseHtmlSubset('<b>' + message + '</b>').firstChild.innerHTML +
284 '</div>';
285 }
286 var connectMessage = this.currentUpdateStatusEvent_.connectionTypes;
287 if (!!connectMessage) {
288 result += '<div>' +
289 parseHtmlSubset('<b>' + connectMessage + '</b>')
dpapad 2017/02/17 02:48:14 It is also worth mentioning that this is only nece
stevenjb 2017/02/17 20:02:41 I think that in principal we prefer to call this f
290 .firstChild.innerHTML +
291 '</div>';
292 }
293 return result;
dpapad 2017/02/17 02:44:28 Nit(optional): We can avoid duplicate logic as fol
stevenjb 2017/02/17 20:02:41 Sure. Done.
282 } 294 }
283 }, 295 },
284 296
285 /** 297 /**
286 * @return {?string} 298 * @return {?string}
287 * @private 299 * @private
288 */ 300 */
289 getIcon_: function() { 301 getIcon_: function() {
290 // If this platform has reached the end of the line, display an error icon 302 // If this platform has reached the end of the line, display an error icon
291 // and ignore UpdateStatus. 303 // and ignore UpdateStatus.
292 if (this.obsoleteSystemInfo_.endOfLine) 304 if (this.obsoleteSystemInfo_.endOfLine)
293 return 'settings:error'; 305 return 'settings:error';
294 306
295 switch (this.currentUpdateStatusEvent_.status) { 307 switch (this.currentUpdateStatusEvent_.status) {
296 case UpdateStatus.DISABLED_BY_ADMIN: 308 case UpdateStatus.DISABLED_BY_ADMIN:
297 return 'cr20:domain'; 309 return 'cr20:domain';
298 case UpdateStatus.FAILED: 310 case UpdateStatus.FAILED:
299 return 'settings:error'; 311 return 'settings:error';
300 case UpdateStatus.UPDATED: 312 case UpdateStatus.UPDATED:
301 case UpdateStatus.NEARLY_UPDATED: 313 case UpdateStatus.NEARLY_UPDATED:
302 return 'settings:check-circle'; 314 return 'settings:check-circle';
303 default: 315 default:
304 return null; 316 return null;
305 } 317 }
306 }, 318 },
307 319
308 /** 320 /**
309 * @return {?string} 321 * @return {?string}
310 * @private 322 * @private
311 */ 323 */
312 getIconSrc_: function() { 324 getIconSrc_: function() {
313 if (this.obsoleteSystemInfo_.endOfLine) 325 if (this.obsoleteSystemInfo_.endOfLine)
314 return null; 326 return null;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 }); 412 });
401 }, 413 },
402 414
403 // <if expr="_google_chrome"> 415 // <if expr="_google_chrome">
404 /** @private */ 416 /** @private */
405 onReportIssueTap_: function() { 417 onReportIssueTap_: function() {
406 this.aboutBrowserProxy_.openFeedbackDialog(); 418 this.aboutBrowserProxy_.openFeedbackDialog();
407 }, 419 },
408 // </if> 420 // </if>
409 }); 421 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698