| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 value: function() { | 43 value: function() { |
| 44 return { | 44 return { |
| 45 obsolete: loadTimeData.getBoolean('aboutObsoleteNowOrSoon'), | 45 obsolete: loadTimeData.getBoolean('aboutObsoleteNowOrSoon'), |
| 46 endOfLine: loadTimeData.getBoolean('aboutObsoleteEndOfTheLine'), | 46 endOfLine: loadTimeData.getBoolean('aboutObsoleteEndOfTheLine'), |
| 47 }; | 47 }; |
| 48 }, | 48 }, |
| 49 }, | 49 }, |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 /** @private {?settings.AboutPageBrowserProxy} */ | 52 /** @private {?settings.AboutPageBrowserProxy} */ |
| 53 browserProxy_: null, | 53 aboutBrowserProxy_: null, |
| 54 |
| 55 /** @private {?settings.LifetimeBrowserProxy} */ |
| 56 lifetimeBrowserProxy_: null, |
| 54 | 57 |
| 55 /** | 58 /** |
| 56 * @type {string} Selector to get the sections. | 59 * @type {string} Selector to get the sections. |
| 57 * TODO(michaelpg): replace duplicate docs with @override once b/24294625 | 60 * TODO(michaelpg): replace duplicate docs with @override once b/24294625 |
| 58 * is fixed. | 61 * is fixed. |
| 59 */ | 62 */ |
| 60 sectionSelector: 'settings-section', | 63 sectionSelector: 'settings-section', |
| 61 | 64 |
| 62 /** @override */ | 65 /** @override */ |
| 63 attached: function() { | 66 attached: function() { |
| 64 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); | 67 this.aboutBrowserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); |
| 65 this.browserProxy_.pageReady(); | 68 this.aboutBrowserProxy_.pageReady(); |
| 69 |
| 70 this.lifetimeBrowserProxy_ = |
| 71 settings.LifetimeBrowserProxyImpl.getInstance(); |
| 66 | 72 |
| 67 <if expr="chromeos"> | 73 <if expr="chromeos"> |
| 68 this.addEventListener('target-channel-changed', function(e) { | 74 this.addEventListener('target-channel-changed', function(e) { |
| 69 this.targetChannel_ = e.detail; | 75 this.targetChannel_ = e.detail; |
| 70 }.bind(this)); | 76 }.bind(this)); |
| 71 | 77 |
| 72 Promise.all([ | 78 Promise.all([ |
| 73 this.browserProxy_.getCurrentChannel(), | 79 this.aboutBrowserProxy_.getCurrentChannel(), |
| 74 this.browserProxy_.getTargetChannel(), | 80 this.aboutBrowserProxy_.getTargetChannel(), |
| 75 ]).then(function(channels) { | 81 ]).then(function(channels) { |
| 76 this.currentChannel_ = channels[0]; | 82 this.currentChannel_ = channels[0]; |
| 77 this.targetChannel_ = channels[1]; | 83 this.targetChannel_ = channels[1]; |
| 78 | 84 |
| 79 this.startListening_(); | 85 this.startListening_(); |
| 80 }.bind(this)); | 86 }.bind(this)); |
| 81 | 87 |
| 82 this.browserProxy_.getRegulatoryInfo().then(function(info) { | 88 this.aboutBrowserProxy_.getRegulatoryInfo().then(function(info) { |
| 83 this.regulatoryInfo_ = info; | 89 this.regulatoryInfo_ = info; |
| 84 }.bind(this)); | 90 }.bind(this)); |
| 85 </if> | 91 </if> |
| 86 <if expr="not chromeos"> | 92 <if expr="not chromeos"> |
| 87 this.startListening_(); | 93 this.startListening_(); |
| 88 </if> | 94 </if> |
| 89 | 95 |
| 90 this.scroller = this.parentElement; | 96 this.scroller = this.parentElement; |
| 91 }, | 97 }, |
| 92 | 98 |
| 93 /** @private */ | 99 /** @private */ |
| 94 startListening_: function() { | 100 startListening_: function() { |
| 95 this.addWebUIListener( | 101 this.addWebUIListener( |
| 96 'update-status-changed', | 102 'update-status-changed', |
| 97 this.onUpdateStatusChanged_.bind(this)); | 103 this.onUpdateStatusChanged_.bind(this)); |
| 98 this.browserProxy_.refreshUpdateStatus(); | 104 this.aboutBrowserProxy_.refreshUpdateStatus(); |
| 99 }, | 105 }, |
| 100 | 106 |
| 101 /** | 107 /** |
| 102 * @param {!UpdateStatusChangedEvent} event | 108 * @param {!UpdateStatusChangedEvent} event |
| 103 * @private | 109 * @private |
| 104 */ | 110 */ |
| 105 onUpdateStatusChanged_: function(event) { | 111 onUpdateStatusChanged_: function(event) { |
| 106 <if expr="chromeos"> | 112 <if expr="chromeos"> |
| 107 if (event.status == UpdateStatus.CHECKING) | 113 if (event.status == UpdateStatus.CHECKING) |
| 108 this.hasCheckedForUpdates_ = true; | 114 this.hasCheckedForUpdates_ = true; |
| 109 </if> | 115 </if> |
| 110 this.currentUpdateStatusEvent_ = event; | 116 this.currentUpdateStatusEvent_ = event; |
| 111 }, | 117 }, |
| 112 | 118 |
| 113 /** @private */ | 119 /** @private */ |
| 114 onHelpTap_: function() { | 120 onHelpTap_: function() { |
| 115 this.browserProxy_.openHelpPage(); | 121 this.aboutBrowserProxy_.openHelpPage(); |
| 116 }, | 122 }, |
| 117 | 123 |
| 118 /** @private */ | 124 /** @private */ |
| 119 onRelaunchTap_: function() { | 125 onRelaunchTap_: function() { |
| 120 this.browserProxy_.relaunchNow(); | 126 this.lifetimeBrowserProxy_.relaunch(); |
| 121 }, | 127 }, |
| 122 | 128 |
| 123 /** | 129 /** |
| 124 * @return {boolean} | 130 * @return {boolean} |
| 125 * @private | 131 * @private |
| 126 */ | 132 */ |
| 127 shouldShowUpdateStatusMessage_: function() { | 133 shouldShowUpdateStatusMessage_: function() { |
| 128 return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && | 134 return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && |
| 129 !this.obsoleteSystemInfo_.endOfLine; | 135 !this.obsoleteSystemInfo_.endOfLine; |
| 130 }, | 136 }, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 252 |
| 247 /** @private */ | 253 /** @private */ |
| 248 onDetailedBuildInfoTap_: function() { | 254 onDetailedBuildInfoTap_: function() { |
| 249 var animatedPages = /** @type {!SettingsAnimatedPagesElement} */ ( | 255 var animatedPages = /** @type {!SettingsAnimatedPagesElement} */ ( |
| 250 this.$.pages); | 256 this.$.pages); |
| 251 animatedPages.setSubpageChain(['detailed-build-info']); | 257 animatedPages.setSubpageChain(['detailed-build-info']); |
| 252 }, | 258 }, |
| 253 | 259 |
| 254 /** @private */ | 260 /** @private */ |
| 255 onRelaunchAndPowerwashTap_: function() { | 261 onRelaunchAndPowerwashTap_: function() { |
| 256 // TODO(dpapad): Implement this. | 262 this.lifetimeBrowserProxy_.factoryReset(); |
| 257 }, | 263 }, |
| 258 | 264 |
| 259 /** | 265 /** |
| 260 * @return {boolean} | 266 * @return {boolean} |
| 261 * @private | 267 * @private |
| 262 */ | 268 */ |
| 263 shouldShowRelaunchAndPowerwash_: function() { | 269 shouldShowRelaunchAndPowerwash_: function() { |
| 264 return this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && | 270 return this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && |
| 265 this.isTargetChannelMoreStable_(); | 271 this.isTargetChannelMoreStable_(); |
| 266 }, | 272 }, |
| 267 | 273 |
| 268 /** @private */ | 274 /** @private */ |
| 269 onCheckUpdatesTap_: function() { | 275 onCheckUpdatesTap_: function() { |
| 270 this.onUpdateStatusChanged_({status: UpdateStatus.CHECKING}); | 276 this.onUpdateStatusChanged_({status: UpdateStatus.CHECKING}); |
| 271 this.browserProxy_.requestUpdate(); | 277 this.aboutBrowserProxy_.requestUpdate(); |
| 272 }, | 278 }, |
| 273 | 279 |
| 274 /** | 280 /** |
| 275 * @return {boolean} | 281 * @return {boolean} |
| 276 * @private | 282 * @private |
| 277 */ | 283 */ |
| 278 shouldShowCheckUpdates_: function() { | 284 shouldShowCheckUpdates_: function() { |
| 279 return !this.hasCheckedForUpdates_ || | 285 return !this.hasCheckedForUpdates_ || |
| 280 this.checkStatus_(UpdateStatus.FAILED); | 286 this.checkStatus_(UpdateStatus.FAILED); |
| 281 }, | 287 }, |
| 282 | 288 |
| 283 /** | 289 /** |
| 284 * @return {boolean} | 290 * @return {boolean} |
| 285 * @private | 291 * @private |
| 286 */ | 292 */ |
| 287 shouldShowRegulatoryInfo_: function() { | 293 shouldShowRegulatoryInfo_: function() { |
| 288 return this.regulatoryInfo_ !== null; | 294 return this.regulatoryInfo_ !== null; |
| 289 }, | 295 }, |
| 290 </if> | 296 </if> |
| 291 | 297 |
| 292 <if expr="_google_chrome"> | 298 <if expr="_google_chrome"> |
| 293 /** @private */ | 299 /** @private */ |
| 294 onReportIssueTap_: function() { | 300 onReportIssueTap_: function() { |
| 295 this.browserProxy_.openFeedbackDialog(); | 301 this.aboutBrowserProxy_.openFeedbackDialog(); |
| 296 }, | 302 }, |
| 297 </if> | 303 </if> |
| 298 }); | 304 }); |
| OLD | NEW |