| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 }, | 220 }, |
| 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 // Do not show the "updated" status if we haven't checked yet or the update |
| 231 // warning dialog is shown to user. |
| 230 if (this.currentUpdateStatusEvent_.status == UpdateStatus.UPDATED && | 232 if (this.currentUpdateStatusEvent_.status == UpdateStatus.UPDATED && |
| 231 !this.hasCheckedForUpdates_) { | 233 (!this.hasCheckedForUpdates_ || this.showUpdateWarningDialog_)) { |
| 232 this.showUpdateStatus_ = false; | 234 this.showUpdateStatus_ = false; |
| 233 return; | 235 return; |
| 234 } | 236 } |
| 235 // </if> | 237 // </if> |
| 236 this.showUpdateStatus_ = | 238 this.showUpdateStatus_ = |
| 237 this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && | 239 this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && |
| 238 !this.obsoleteSystemInfo_.endOfLine; | 240 !this.obsoleteSystemInfo_.endOfLine; |
| 239 }, | 241 }, |
| 240 | 242 |
| 241 /** | 243 /** |
| (...skipping 22 matching lines...) Expand all Loading... |
| 264 // </if> | 266 // </if> |
| 265 }, | 267 }, |
| 266 | 268 |
| 267 /** | 269 /** |
| 268 * @return {string} | 270 * @return {string} |
| 269 * @private | 271 * @private |
| 270 */ | 272 */ |
| 271 getUpdateStatusMessage_: function() { | 273 getUpdateStatusMessage_: function() { |
| 272 switch (this.currentUpdateStatusEvent_.status) { | 274 switch (this.currentUpdateStatusEvent_.status) { |
| 273 case UpdateStatus.CHECKING: | 275 case UpdateStatus.CHECKING: |
| 276 case UpdateStatus.NEED_PERMISSION_TO_UPDATE: |
| 274 return this.i18n('aboutUpgradeCheckStarted'); | 277 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: | 278 case UpdateStatus.NEARLY_UPDATED: |
| 283 // <if expr="chromeos"> | 279 // <if expr="chromeos"> |
| 284 if (this.currentChannel_ != this.targetChannel_) | 280 if (this.currentChannel_ != this.targetChannel_) |
| 285 return this.i18n('aboutUpgradeSuccessChannelSwitch'); | 281 return this.i18n('aboutUpgradeSuccessChannelSwitch'); |
| 286 // </if> | 282 // </if> |
| 287 return this.i18n('aboutUpgradeRelaunch'); | 283 return this.i18n('aboutUpgradeRelaunch'); |
| 288 case UpdateStatus.UPDATED: | 284 case UpdateStatus.UPDATED: |
| 289 return this.i18n('aboutUpgradeUpToDate'); | 285 return this.i18n('aboutUpgradeUpToDate'); |
| 290 case UpdateStatus.UPDATING: | 286 case UpdateStatus.UPDATING: |
| 291 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); | 287 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 /** | 409 /** |
| 414 * @return {boolean} | 410 * @return {boolean} |
| 415 * @private | 411 * @private |
| 416 */ | 412 */ |
| 417 computeShowCheckUpdates_: function() { | 413 computeShowCheckUpdates_: function() { |
| 418 // Enable the update button if we are in a stale 'updated' status or | 414 // Enable the update button if we are in a stale 'updated' status or |
| 419 // update has failed. Disable it otherwise. | 415 // update has failed. Disable it otherwise. |
| 420 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && | 416 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && |
| 421 this.checkStatus_(UpdateStatus.UPDATED); | 417 this.checkStatus_(UpdateStatus.UPDATED); |
| 422 | 418 |
| 423 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED) || | 419 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED); |
| 424 this.checkStatus_(UpdateStatus.NEED_PERMISSION_TO_UPDATE); | |
| 425 }, | 420 }, |
| 426 | 421 |
| 427 /** | 422 /** |
| 428 * @return {boolean} | 423 * @return {boolean} |
| 429 * @private | 424 * @private |
| 430 */ | 425 */ |
| 431 shouldShowRegulatoryInfo_: function() { | 426 shouldShowRegulatoryInfo_: function() { |
| 432 return this.regulatoryInfo_ !== null; | 427 return this.regulatoryInfo_ !== null; |
| 433 }, | 428 }, |
| 434 | 429 |
| 435 /** @private */ | 430 /** @private */ |
| 436 onUpdateWarningDialogClose_: function() { | 431 onUpdateWarningDialogClose_: function() { |
| 437 this.showUpdateWarningDialog_ = false; | 432 this.showUpdateWarningDialog_ = false; |
| 433 // Shows 'check for updates' button in case that the user cancels the |
| 434 // dialog and then intends to check for update again. |
| 435 this.hasCheckedForUpdates_ = false; |
| 438 }, | 436 }, |
| 439 // </if> | 437 // </if> |
| 440 | 438 |
| 441 /** @private */ | 439 /** @private */ |
| 442 onProductLogoTap_: function() { | 440 onProductLogoTap_: function() { |
| 443 this.$['product-logo'].animate({ | 441 this.$['product-logo'].animate({ |
| 444 transform: ['none', 'rotate(-10turn)'], | 442 transform: ['none', 'rotate(-10turn)'], |
| 445 }, { | 443 }, { |
| 446 duration: 500, | 444 duration: 500, |
| 447 easing: 'cubic-bezier(1, 0, 0, 1)', | 445 easing: 'cubic-bezier(1, 0, 0, 1)', |
| 448 }); | 446 }); |
| 449 }, | 447 }, |
| 450 | 448 |
| 451 // <if expr="_google_chrome"> | 449 // <if expr="_google_chrome"> |
| 452 /** @private */ | 450 /** @private */ |
| 453 onReportIssueTap_: function() { | 451 onReportIssueTap_: function() { |
| 454 this.aboutBrowserProxy_.openFeedbackDialog(); | 452 this.aboutBrowserProxy_.openFeedbackDialog(); |
| 455 }, | 453 }, |
| 456 // </if> | 454 // </if> |
| 457 }); | 455 }); |
| OLD | NEW |