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 | |
5 /** | 4 /** |
6 * @fileoverview 'settings-about-page' contains version and OS related | 5 * @fileoverview 'settings-about-page' contains version and OS related |
7 * information. | 6 * information. |
8 */ | 7 */ |
9 Polymer({ | 8 Polymer({ |
10 is: 'settings-about-page', | 9 is: 'settings-about-page', |
11 | 10 |
12 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior], | 11 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior], |
13 | 12 |
14 properties: { | 13 properties: { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 /** @private {!Map<string, string>} */ | 76 /** @private {!Map<string, string>} */ |
78 focusConfig_: { | 77 focusConfig_: { |
79 type: Object, | 78 type: Object, |
80 value: function() { | 79 value: function() { |
81 var map = new Map(); | 80 var map = new Map(); |
82 map.set( | 81 map.set( |
83 settings.Route.DETAILED_BUILD_INFO.path, | 82 settings.Route.DETAILED_BUILD_INFO.path, |
84 '#detailed-build-info-trigger'); | 83 '#detailed-build-info-trigger'); |
85 return map; | 84 return map; |
86 }, | 85 }, |
87 } | 86 }, |
| 87 |
| 88 /** @private */ |
| 89 showUpdateWarningDialog_: { |
| 90 type: Boolean, |
| 91 value: false, |
| 92 }, |
88 // </if> | 93 // </if> |
89 }, | 94 }, |
90 | 95 |
91 observers: [ | 96 observers: [ |
92 // <if expr="not chromeos"> | 97 // <if expr="not chromeos"> |
93 'updateShowUpdateStatus_(' + | 98 'updateShowUpdateStatus_(' + |
94 'obsoleteSystemInfo_, currentUpdateStatusEvent_)', | 99 'obsoleteSystemInfo_, currentUpdateStatusEvent_)', |
95 'updateShowRelaunch_(currentUpdateStatusEvent_)', | 100 'updateShowRelaunch_(currentUpdateStatusEvent_)', |
96 'updateShowButtonContainer_(showRelaunch_)', | 101 'updateShowButtonContainer_(showRelaunch_)', |
97 // </if> | 102 // </if> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 }, | 161 }, |
157 | 162 |
158 /** | 163 /** |
159 * @param {!UpdateStatusChangedEvent} event | 164 * @param {!UpdateStatusChangedEvent} event |
160 * @private | 165 * @private |
161 */ | 166 */ |
162 onUpdateStatusChanged_: function(event) { | 167 onUpdateStatusChanged_: function(event) { |
163 // <if expr="chromeos"> | 168 // <if expr="chromeos"> |
164 if (event.status == UpdateStatus.CHECKING) | 169 if (event.status == UpdateStatus.CHECKING) |
165 this.hasCheckedForUpdates_ = true; | 170 this.hasCheckedForUpdates_ = true; |
| 171 else if (event.status == UpdateStatus.NEED_PERMISSION_TO_UPDATE) { |
| 172 this.showUpdateWarningDialog_ = true; |
| 173 // Async to wait for dialog to appear in the DOM. |
| 174 this.async(function() { |
| 175 var dialog = this.$$('settings-update-warning-dialog'); |
| 176 // event includes the update version and size in bytes. |
| 177 dialog.setUpdateWarningMessage(event.version, event.size); |
| 178 // Register listener to detect when the dialog is closed. Flip the |
| 179 // boolean once closed to force a restamp next time it is shown such |
| 180 // that the previous dialog's contents are cleared. |
| 181 dialog.addEventListener('close', function() { |
| 182 this.showUpdateWarningDialog_ = false; |
| 183 }.bind(this)); |
| 184 }.bind(this)); |
| 185 } |
166 // </if> | 186 // </if> |
167 this.currentUpdateStatusEvent_ = event; | 187 this.currentUpdateStatusEvent_ = event; |
168 }, | 188 }, |
169 | 189 |
170 // <if expr="_google_chrome and is_macosx"> | 190 // <if expr="_google_chrome and is_macosx"> |
171 /** | 191 /** |
172 * @param {!PromoteUpdaterStatus} status | 192 * @param {!PromoteUpdaterStatus} status |
173 * @private | 193 * @private |
174 */ | 194 */ |
175 onPromoteUpdaterStatusChanged_: function(status) { | 195 onPromoteUpdaterStatusChanged_: function(status) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 }, | 271 }, |
252 | 272 |
253 /** | 273 /** |
254 * @return {string} | 274 * @return {string} |
255 * @private | 275 * @private |
256 */ | 276 */ |
257 getUpdateStatusMessage_: function() { | 277 getUpdateStatusMessage_: function() { |
258 switch (this.currentUpdateStatusEvent_.status) { | 278 switch (this.currentUpdateStatusEvent_.status) { |
259 case UpdateStatus.CHECKING: | 279 case UpdateStatus.CHECKING: |
260 return this.i18n('aboutUpgradeCheckStarted'); | 280 return this.i18n('aboutUpgradeCheckStarted'); |
| 281 case UpdateStatus.NEED_PERMISSION_TO_UPDATE: |
| 282 return ""; |
261 case UpdateStatus.NEARLY_UPDATED: | 283 case UpdateStatus.NEARLY_UPDATED: |
262 // <if expr="chromeos"> | 284 // <if expr="chromeos"> |
263 if (this.currentChannel_ != this.targetChannel_) | 285 if (this.currentChannel_ != this.targetChannel_) |
264 return this.i18n('aboutUpgradeSuccessChannelSwitch'); | 286 return this.i18n('aboutUpgradeSuccessChannelSwitch'); |
265 // </if> | 287 // </if> |
266 return this.i18n('aboutUpgradeRelaunch'); | 288 return this.i18n('aboutUpgradeRelaunch'); |
267 case UpdateStatus.UPDATED: | 289 case UpdateStatus.UPDATED: |
268 return this.i18n('aboutUpgradeUpToDate'); | 290 return this.i18n('aboutUpgradeUpToDate'); |
269 case UpdateStatus.UPDATING: | 291 case UpdateStatus.UPDATING: |
270 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); | 292 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 /** | 414 /** |
393 * @return {boolean} | 415 * @return {boolean} |
394 * @private | 416 * @private |
395 */ | 417 */ |
396 computeShowCheckUpdates_: function() { | 418 computeShowCheckUpdates_: function() { |
397 // Enable the update button if we are in a stale 'updated' status or | 419 // Enable the update button if we are in a stale 'updated' status or |
398 // update has failed. Disable it otherwise. | 420 // update has failed. Disable it otherwise. |
399 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && | 421 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && |
400 this.checkStatus_(UpdateStatus.UPDATED); | 422 this.checkStatus_(UpdateStatus.UPDATED); |
401 | 423 |
402 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED); | 424 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED) || |
| 425 this.checkStatus_(UpdateStatus.NEED_PERMISSION_TO_UPDATE); |
403 }, | 426 }, |
404 | 427 |
405 /** | 428 /** |
406 * @return {boolean} | 429 * @return {boolean} |
407 * @private | 430 * @private |
408 */ | 431 */ |
409 shouldShowRegulatoryInfo_: function() { | 432 shouldShowRegulatoryInfo_: function() { |
410 return this.regulatoryInfo_ !== null; | 433 return this.regulatoryInfo_ !== null; |
411 }, | 434 }, |
412 // </if> | 435 // </if> |
413 | 436 |
414 /** @private */ | 437 /** @private */ |
415 onProductLogoTap_: function() { | 438 onProductLogoTap_: function() { |
416 this.$['product-logo'].animate({ | 439 this.$['product-logo'].animate({ |
417 transform: ['none', 'rotate(-10turn)'], | 440 transform: ['none', 'rotate(-10turn)'], |
418 }, { | 441 }, { |
419 duration: 500, | 442 duration: 500, |
420 easing: 'cubic-bezier(1, 0, 0, 1)', | 443 easing: 'cubic-bezier(1, 0, 0, 1)', |
421 }); | 444 }); |
422 }, | 445 }, |
423 | 446 |
424 // <if expr="_google_chrome"> | 447 // <if expr="_google_chrome"> |
425 /** @private */ | 448 /** @private */ |
426 onReportIssueTap_: function() { | 449 onReportIssueTap_: function() { |
427 this.aboutBrowserProxy_.openFeedbackDialog(); | 450 this.aboutBrowserProxy_.openFeedbackDialog(); |
428 }, | 451 }, |
429 // </if> | 452 // </if> |
430 }); | 453 }); |
OLD | NEW |