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 */ |
|
xiyuan
2017/05/12 17:59:28
nit: insert an empty line after the @fileoverview
weidongg
2017/05/12 18:17:23
Done.
| |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-about-page', | 10 is: 'settings-about-page', |
| 11 | 11 |
| 12 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior], | 12 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior], |
| 13 | 13 |
| 14 properties: { | 14 properties: { |
| 15 /** @private {?UpdateStatusChangedEvent} */ | 15 /** @private {?UpdateStatusChangedEvent} */ |
| 16 currentUpdateStatusEvent_: { | 16 currentUpdateStatusEvent_: { |
| 17 type: Object, | 17 type: Object, |
| 18 value: {message: '', progress: 0, status: UpdateStatus.DISABLED}, | 18 value: {message: '', progress: 0, status: UpdateStatus.DISABLED}, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 /** @private {!Map<string, string>} */ | 77 /** @private {!Map<string, string>} */ |
| 78 focusConfig_: { | 78 focusConfig_: { |
| 79 type: Object, | 79 type: Object, |
| 80 value: function() { | 80 value: function() { |
| 81 var map = new Map(); | 81 var map = new Map(); |
| 82 map.set( | 82 map.set( |
| 83 settings.Route.DETAILED_BUILD_INFO.path, | 83 settings.Route.DETAILED_BUILD_INFO.path, |
| 84 '#detailed-build-info-trigger'); | 84 '#detailed-build-info-trigger'); |
| 85 return map; | 85 return map; |
| 86 }, | 86 }, |
| 87 } | 87 }, |
| 88 | |
| 89 /** @private */ | |
| 90 showUpdateWarningDialog_: { | |
| 91 type: Boolean, | |
| 92 value: false, | |
| 93 }, | |
| 94 | |
| 95 /** @private {!AboutPageUpdateInfo|undefined} */ | |
| 96 updateInfo_: Object, | |
| 88 // </if> | 97 // </if> |
| 89 }, | 98 }, |
| 90 | 99 |
| 91 observers: [ | 100 observers: [ |
| 92 // <if expr="not chromeos"> | 101 // <if expr="not chromeos"> |
| 93 'updateShowUpdateStatus_(' + | 102 'updateShowUpdateStatus_(' + |
| 94 'obsoleteSystemInfo_, currentUpdateStatusEvent_)', | 103 'obsoleteSystemInfo_, currentUpdateStatusEvent_)', |
| 95 'updateShowRelaunch_(currentUpdateStatusEvent_)', | 104 'updateShowRelaunch_(currentUpdateStatusEvent_)', |
| 96 'updateShowButtonContainer_(showRelaunch_)', | 105 'updateShowButtonContainer_(showRelaunch_)', |
| 97 // </if> | 106 // </if> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 }, | 165 }, |
| 157 | 166 |
| 158 /** | 167 /** |
| 159 * @param {!UpdateStatusChangedEvent} event | 168 * @param {!UpdateStatusChangedEvent} event |
| 160 * @private | 169 * @private |
| 161 */ | 170 */ |
| 162 onUpdateStatusChanged_: function(event) { | 171 onUpdateStatusChanged_: function(event) { |
| 163 // <if expr="chromeos"> | 172 // <if expr="chromeos"> |
| 164 if (event.status == UpdateStatus.CHECKING) | 173 if (event.status == UpdateStatus.CHECKING) |
| 165 this.hasCheckedForUpdates_ = true; | 174 this.hasCheckedForUpdates_ = true; |
| 175 else if (event.status == UpdateStatus.NEED_PERMISSION_TO_UPDATE) { | |
| 176 this.showUpdateWarningDialog_ = true; | |
| 177 this.updateInfo_ = {version: event.version, size: event.size}; | |
| 178 } | |
| 166 // </if> | 179 // </if> |
| 167 this.currentUpdateStatusEvent_ = event; | 180 this.currentUpdateStatusEvent_ = event; |
| 168 }, | 181 }, |
| 169 | 182 |
| 170 // <if expr="_google_chrome and is_macosx"> | 183 // <if expr="_google_chrome and is_macosx"> |
| 171 /** | 184 /** |
| 172 * @param {!PromoteUpdaterStatus} status | 185 * @param {!PromoteUpdaterStatus} status |
| 173 * @private | 186 * @private |
| 174 */ | 187 */ |
| 175 onPromoteUpdaterStatusChanged_: function(status) { | 188 onPromoteUpdaterStatusChanged_: function(status) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 }, | 264 }, |
| 252 | 265 |
| 253 /** | 266 /** |
| 254 * @return {string} | 267 * @return {string} |
| 255 * @private | 268 * @private |
| 256 */ | 269 */ |
| 257 getUpdateStatusMessage_: function() { | 270 getUpdateStatusMessage_: function() { |
| 258 switch (this.currentUpdateStatusEvent_.status) { | 271 switch (this.currentUpdateStatusEvent_.status) { |
| 259 case UpdateStatus.CHECKING: | 272 case UpdateStatus.CHECKING: |
| 260 return this.i18n('aboutUpgradeCheckStarted'); | 273 return this.i18n('aboutUpgradeCheckStarted'); |
| 274 case UpdateStatus.NEED_PERMISSION_TO_UPDATE: | |
| 275 // This status is immediately followed by an reporting error status. | |
| 276 // When update engine reports error, UI just shows that your device is | |
| 277 // up to date. This is a bug that needs to be fixed in the future. | |
| 278 // TODO(weidongg/581071): Show proper message when update engine aborts | |
| 279 // due to cellular connection. | |
| 280 return ''; | |
| 261 case UpdateStatus.NEARLY_UPDATED: | 281 case UpdateStatus.NEARLY_UPDATED: |
| 262 // <if expr="chromeos"> | 282 // <if expr="chromeos"> |
| 263 if (this.currentChannel_ != this.targetChannel_) | 283 if (this.currentChannel_ != this.targetChannel_) |
| 264 return this.i18n('aboutUpgradeSuccessChannelSwitch'); | 284 return this.i18n('aboutUpgradeSuccessChannelSwitch'); |
| 265 // </if> | 285 // </if> |
| 266 return this.i18n('aboutUpgradeRelaunch'); | 286 return this.i18n('aboutUpgradeRelaunch'); |
| 267 case UpdateStatus.UPDATED: | 287 case UpdateStatus.UPDATED: |
| 268 return this.i18n('aboutUpgradeUpToDate'); | 288 return this.i18n('aboutUpgradeUpToDate'); |
| 269 case UpdateStatus.UPDATING: | 289 case UpdateStatus.UPDATING: |
| 270 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); | 290 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 /** | 412 /** |
| 393 * @return {boolean} | 413 * @return {boolean} |
| 394 * @private | 414 * @private |
| 395 */ | 415 */ |
| 396 computeShowCheckUpdates_: function() { | 416 computeShowCheckUpdates_: function() { |
| 397 // Enable the update button if we are in a stale 'updated' status or | 417 // Enable the update button if we are in a stale 'updated' status or |
| 398 // update has failed. Disable it otherwise. | 418 // update has failed. Disable it otherwise. |
| 399 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && | 419 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && |
| 400 this.checkStatus_(UpdateStatus.UPDATED); | 420 this.checkStatus_(UpdateStatus.UPDATED); |
| 401 | 421 |
| 402 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED); | 422 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED) || |
| 423 this.checkStatus_(UpdateStatus.NEED_PERMISSION_TO_UPDATE); | |
| 403 }, | 424 }, |
| 404 | 425 |
| 405 /** | 426 /** |
| 406 * @return {boolean} | 427 * @return {boolean} |
| 407 * @private | 428 * @private |
| 408 */ | 429 */ |
| 409 shouldShowRegulatoryInfo_: function() { | 430 shouldShowRegulatoryInfo_: function() { |
| 410 return this.regulatoryInfo_ !== null; | 431 return this.regulatoryInfo_ !== null; |
| 411 }, | 432 }, |
| 433 | |
| 434 /** @private */ | |
| 435 onUpdateWarningDialogClose_: function() { | |
| 436 this.showUpdateWarningDialog_ = false; | |
| 437 }, | |
| 412 // </if> | 438 // </if> |
| 413 | 439 |
| 414 /** @private */ | 440 /** @private */ |
| 415 onProductLogoTap_: function() { | 441 onProductLogoTap_: function() { |
| 416 this.$['product-logo'].animate({ | 442 this.$['product-logo'].animate({ |
| 417 transform: ['none', 'rotate(-10turn)'], | 443 transform: ['none', 'rotate(-10turn)'], |
| 418 }, { | 444 }, { |
| 419 duration: 500, | 445 duration: 500, |
| 420 easing: 'cubic-bezier(1, 0, 0, 1)', | 446 easing: 'cubic-bezier(1, 0, 0, 1)', |
| 421 }); | 447 }); |
| 422 }, | 448 }, |
| 423 | 449 |
| 424 // <if expr="_google_chrome"> | 450 // <if expr="_google_chrome"> |
| 425 /** @private */ | 451 /** @private */ |
| 426 onReportIssueTap_: function() { | 452 onReportIssueTap_: function() { |
| 427 this.aboutBrowserProxy_.openFeedbackDialog(); | 453 this.aboutBrowserProxy_.openFeedbackDialog(); |
| 428 }, | 454 }, |
| 429 // </if> | 455 // </if> |
| 430 }); | 456 }); |
| OLD | NEW |