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 | 9 |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 /** @private */ | 65 /** @private */ |
| 66 showRelaunchAndPowerwash_: { | 66 showRelaunchAndPowerwash_: { |
| 67 type: Boolean, | 67 type: Boolean, |
| 68 computed: 'computeShowRelaunchAndPowerwash_(' + | 68 computed: 'computeShowRelaunchAndPowerwash_(' + |
| 69 'currentUpdateStatusEvent_, targetChannel_)', | 69 'currentUpdateStatusEvent_, targetChannel_)', |
| 70 }, | 70 }, |
| 71 | 71 |
| 72 /** @private */ | 72 /** @private */ |
| 73 showCheckUpdates_: { | 73 showCheckUpdates_: { |
| 74 type: Boolean, | 74 type: Boolean, |
| 75 computed: 'computeShowCheckUpdates_(currentUpdateStatusEvent_)', | 75 computed: 'computeShowCheckUpdates_(' + |
| 76 'currentUpdateStatusEvent_, hasCheckedForUpdates_)', | |
| 76 }, | 77 }, |
| 77 | 78 |
| 78 /** @private {!Map<string, string>} */ | 79 /** @private {!Map<string, string>} */ |
| 79 focusConfig_: { | 80 focusConfig_: { |
| 80 type: Object, | 81 type: Object, |
| 81 value: function() { | 82 value: function() { |
| 82 var map = new Map(); | 83 var map = new Map(); |
| 83 map.set( | 84 map.set( |
| 84 settings.Route.DETAILED_BUILD_INFO.path, | 85 settings.Route.DETAILED_BUILD_INFO.path, |
| 85 '#detailed-build-info-trigger'); | 86 '#detailed-build-info-trigger'); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 // </if> | 165 // </if> |
| 165 this.aboutBrowserProxy_.refreshUpdateStatus(); | 166 this.aboutBrowserProxy_.refreshUpdateStatus(); |
| 166 }, | 167 }, |
| 167 | 168 |
| 168 /** | 169 /** |
| 169 * @param {!UpdateStatusChangedEvent} event | 170 * @param {!UpdateStatusChangedEvent} event |
| 170 * @private | 171 * @private |
| 171 */ | 172 */ |
| 172 onUpdateStatusChanged_: function(event) { | 173 onUpdateStatusChanged_: function(event) { |
| 173 // <if expr="chromeos"> | 174 // <if expr="chromeos"> |
| 174 if (event.status == UpdateStatus.CHECKING) | 175 if (event.status == UpdateStatus.CHECKING) { |
| 175 this.hasCheckedForUpdates_ = true; | 176 this.hasCheckedForUpdates_ = true; |
| 176 else if (event.status == UpdateStatus.NEED_PERMISSION_TO_UPDATE) { | 177 } else if (event.status == UpdateStatus.NEED_PERMISSION_TO_UPDATE) { |
| 177 this.showUpdateWarningDialog_ = true; | 178 this.showUpdateWarningDialog_ = true; |
| 178 this.updateInfo_ = {version: event.version, size: event.size}; | 179 this.updateInfo_ = {version: event.version, size: event.size}; |
| 179 } | 180 } |
| 180 // </if> | 181 // </if> |
| 181 this.currentUpdateStatusEvent_ = event; | 182 this.currentUpdateStatusEvent_ = event; |
| 182 }, | 183 }, |
| 183 | 184 |
| 184 // <if expr="_google_chrome and is_macosx"> | 185 // <if expr="_google_chrome and is_macosx"> |
| 185 /** | 186 /** |
| 186 * @param {!PromoteUpdaterStatus} status | 187 * @param {!PromoteUpdaterStatus} status |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 | 221 |
| 221 /** @private */ | 222 /** @private */ |
| 222 onRelaunchTap_: function() { | 223 onRelaunchTap_: function() { |
| 223 this.lifetimeBrowserProxy_.relaunch(); | 224 this.lifetimeBrowserProxy_.relaunch(); |
| 224 }, | 225 }, |
| 225 | 226 |
| 226 /** @private */ | 227 /** @private */ |
| 227 updateShowUpdateStatus_: function() { | 228 updateShowUpdateStatus_: function() { |
| 228 // <if expr="chromeos"> | 229 // <if expr="chromeos"> |
| 229 // Assume the "updated" status is stale if we haven't checked yet. | 230 // Assume the "updated" status is stale if we haven't checked yet. |
| 231 // Prevents the updated status being shown to user when an update warning | |
| 232 // dialog is shown. | |
|
xiyuan
2017/05/22 22:36:34
nit: can you combine the new comment with old one?
weidongg
2017/05/23 00:17:00
Done.
| |
| 230 if (this.currentUpdateStatusEvent_.status == UpdateStatus.UPDATED && | 233 if (this.currentUpdateStatusEvent_.status == UpdateStatus.UPDATED && |
| 231 !this.hasCheckedForUpdates_) { | 234 (!this.hasCheckedForUpdates_ || this.showUpdateWarningDialog_)) { |
| 232 this.showUpdateStatus_ = false; | 235 this.showUpdateStatus_ = false; |
| 233 return; | 236 return; |
| 234 } | 237 } |
| 235 // </if> | 238 // </if> |
| 236 this.showUpdateStatus_ = | 239 this.showUpdateStatus_ = |
| 237 this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && | 240 this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && |
| 238 !this.obsoleteSystemInfo_.endOfLine; | 241 !this.obsoleteSystemInfo_.endOfLine; |
| 239 }, | 242 }, |
| 240 | 243 |
| 241 /** | 244 /** |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 264 // </if> | 267 // </if> |
| 265 }, | 268 }, |
| 266 | 269 |
| 267 /** | 270 /** |
| 268 * @return {string} | 271 * @return {string} |
| 269 * @private | 272 * @private |
| 270 */ | 273 */ |
| 271 getUpdateStatusMessage_: function() { | 274 getUpdateStatusMessage_: function() { |
| 272 switch (this.currentUpdateStatusEvent_.status) { | 275 switch (this.currentUpdateStatusEvent_.status) { |
| 273 case UpdateStatus.CHECKING: | 276 case UpdateStatus.CHECKING: |
| 277 case UpdateStatus.NEED_PERMISSION_TO_UPDATE: | |
| 274 return this.i18n('aboutUpgradeCheckStarted'); | 278 return this.i18n('aboutUpgradeCheckStarted'); |
| 275 case UpdateStatus.NEED_PERMISSION_TO_UPDATE: | |
| 276 // This status is immediately followed by an reporting error status. | |
| 277 // When update engine reports error, UI just shows that your device is | |
| 278 // up to date. This is a bug that needs to be fixed in the future. | |
| 279 // TODO(weidongg/581071): Show proper message when update engine aborts | |
| 280 // due to cellular connection. | |
| 281 return ''; | |
| 282 case UpdateStatus.NEARLY_UPDATED: | 279 case UpdateStatus.NEARLY_UPDATED: |
| 283 // <if expr="chromeos"> | 280 // <if expr="chromeos"> |
| 284 if (this.currentChannel_ != this.targetChannel_) | 281 if (this.currentChannel_ != this.targetChannel_) |
| 285 return this.i18n('aboutUpgradeSuccessChannelSwitch'); | 282 return this.i18n('aboutUpgradeSuccessChannelSwitch'); |
| 286 // </if> | 283 // </if> |
| 287 return this.i18n('aboutUpgradeRelaunch'); | 284 return this.i18n('aboutUpgradeRelaunch'); |
| 288 case UpdateStatus.UPDATED: | 285 case UpdateStatus.UPDATED: |
| 289 return this.i18n('aboutUpgradeUpToDate'); | 286 return this.i18n('aboutUpgradeUpToDate'); |
| 290 case UpdateStatus.UPDATING: | 287 case UpdateStatus.UPDATING: |
| 291 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); | 288 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 /** | 410 /** |
| 414 * @return {boolean} | 411 * @return {boolean} |
| 415 * @private | 412 * @private |
| 416 */ | 413 */ |
| 417 computeShowCheckUpdates_: function() { | 414 computeShowCheckUpdates_: function() { |
| 418 // Enable the update button if we are in a stale 'updated' status or | 415 // Enable the update button if we are in a stale 'updated' status or |
| 419 // update has failed. Disable it otherwise. | 416 // update has failed. Disable it otherwise. |
| 420 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && | 417 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && |
| 421 this.checkStatus_(UpdateStatus.UPDATED); | 418 this.checkStatus_(UpdateStatus.UPDATED); |
| 422 | 419 |
| 423 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED) || | 420 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED); |
| 424 this.checkStatus_(UpdateStatus.NEED_PERMISSION_TO_UPDATE); | |
| 425 }, | 421 }, |
| 426 | 422 |
| 427 /** | 423 /** |
| 428 * @return {boolean} | 424 * @return {boolean} |
| 429 * @private | 425 * @private |
| 430 */ | 426 */ |
| 431 shouldShowRegulatoryInfo_: function() { | 427 shouldShowRegulatoryInfo_: function() { |
| 432 return this.regulatoryInfo_ !== null; | 428 return this.regulatoryInfo_ !== null; |
| 433 }, | 429 }, |
| 434 | 430 |
| 435 /** @private */ | 431 /** @private */ |
| 436 onUpdateWarningDialogClose_: function() { | 432 onUpdateWarningDialogClose_: function() { |
| 437 this.showUpdateWarningDialog_ = false; | 433 this.showUpdateWarningDialog_ = false; |
| 434 // Shows 'check for updates' button in case that the user cancels the | |
| 435 // dialog and then intends to check for update again. | |
| 436 this.hasCheckedForUpdates_ = false; | |
|
xiyuan
2017/05/22 22:36:34
This runs when user clicks "Continue" on the dialo
weidongg
2017/05/23 00:17:00
Yes, you are right. This runs whenever the dialog
| |
| 438 }, | 437 }, |
| 439 // </if> | 438 // </if> |
| 440 | 439 |
| 441 /** @private */ | 440 /** @private */ |
| 442 onProductLogoTap_: function() { | 441 onProductLogoTap_: function() { |
| 443 this.$['product-logo'].animate({ | 442 this.$['product-logo'].animate({ |
| 444 transform: ['none', 'rotate(-10turn)'], | 443 transform: ['none', 'rotate(-10turn)'], |
| 445 }, { | 444 }, { |
| 446 duration: 500, | 445 duration: 500, |
| 447 easing: 'cubic-bezier(1, 0, 0, 1)', | 446 easing: 'cubic-bezier(1, 0, 0, 1)', |
| 448 }); | 447 }); |
| 449 }, | 448 }, |
| 450 | 449 |
| 451 // <if expr="_google_chrome"> | 450 // <if expr="_google_chrome"> |
| 452 /** @private */ | 451 /** @private */ |
| 453 onReportIssueTap_: function() { | 452 onReportIssueTap_: function() { |
| 454 this.aboutBrowserProxy_.openFeedbackDialog(); | 453 this.aboutBrowserProxy_.openFeedbackDialog(); |
| 455 }, | 454 }, |
| 456 // </if> | 455 // </if> |
| 457 }); | 456 }); |
| OLD | NEW |