Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 function formatMessage(msg) { | |
| 280 return '<div>' + | |
| 281 parseHtmlSubset('<b>' + msg + '</b>').firstChild.innerHTML + | |
| 282 '</div>'; | |
| 283 } | |
| 284 var result = ''; | |
| 278 var message = this.currentUpdateStatusEvent_.message; | 285 var message = this.currentUpdateStatusEvent_.message; |
| 279 return message ? | 286 if (!!message) |
|
Dan Beam
2017/02/24 00:50:57
this is the same as if (message)
| |
| 280 parseHtmlSubset('<b>' + message + '</b>').firstChild.innerHTML : | 287 result += formatMessage(message); |
| 281 ''; | 288 var connectMessage = this.currentUpdateStatusEvent_.connectionTypes; |
| 289 if (!!connectMessage) | |
| 290 result += formatMessage(connectMessage); | |
| 291 return result; | |
| 282 } | 292 } |
| 283 }, | 293 }, |
| 284 | 294 |
| 285 /** | 295 /** |
| 286 * @return {?string} | 296 * @return {?string} |
| 287 * @private | 297 * @private |
| 288 */ | 298 */ |
| 289 getIcon_: function() { | 299 getIcon_: function() { |
| 290 // If this platform has reached the end of the line, display an error icon | 300 // If this platform has reached the end of the line, display an error icon |
| 291 // and ignore UpdateStatus. | 301 // and ignore UpdateStatus. |
| 292 if (this.obsoleteSystemInfo_.endOfLine) | 302 if (this.obsoleteSystemInfo_.endOfLine) |
| 293 return 'settings:error'; | 303 return 'settings:error'; |
| 294 | 304 |
| 295 switch (this.currentUpdateStatusEvent_.status) { | 305 switch (this.currentUpdateStatusEvent_.status) { |
| 296 case UpdateStatus.DISABLED_BY_ADMIN: | 306 case UpdateStatus.DISABLED_BY_ADMIN: |
| 297 return 'cr20:domain'; | 307 return 'cr20:domain'; |
| 298 case UpdateStatus.FAILED: | 308 case UpdateStatus.FAILED: |
| 299 return 'settings:error'; | 309 return 'settings:error'; |
| 300 case UpdateStatus.UPDATED: | 310 case UpdateStatus.UPDATED: |
| 301 case UpdateStatus.NEARLY_UPDATED: | 311 case UpdateStatus.NEARLY_UPDATED: |
| 302 return 'settings:check-circle'; | 312 return 'settings:check-circle'; |
| 303 default: | 313 default: |
| 304 return null; | 314 return null; |
| 305 } | 315 } |
| 306 }, | 316 }, |
| 307 | 317 |
| 308 /** | 318 /** |
| 309 * @return {?string} | 319 * @return {?string} |
| 310 * @private | 320 * @private |
| 311 */ | 321 */ |
| 312 getIconSrc_: function() { | 322 getIconSrc_: function() { |
| 313 if (this.obsoleteSystemInfo_.endOfLine) | 323 if (this.obsoleteSystemInfo_.endOfLine) |
| 314 return null; | 324 return null; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 }); | 410 }); |
| 401 }, | 411 }, |
| 402 | 412 |
| 403 // <if expr="_google_chrome"> | 413 // <if expr="_google_chrome"> |
| 404 /** @private */ | 414 /** @private */ |
| 405 onReportIssueTap_: function() { | 415 onReportIssueTap_: function() { |
| 406 this.aboutBrowserProxy_.openFeedbackDialog(); | 416 this.aboutBrowserProxy_.openFeedbackDialog(); |
| 407 }, | 417 }, |
| 408 // </if> | 418 // </if> |
| 409 }); | 419 }); |
| OLD | NEW |