| 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-detailed-build-info' contains detailed build | 6 * @fileoverview 'settings-detailed-build-info' contains detailed build |
| 7 * information for ChromeOS. | 7 * information for ChromeOS. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 Polymer({ | 10 Polymer({ |
| 11 is: 'settings-detailed-build-info', | 11 is: 'settings-detailed-build-info', |
| 12 | 12 |
| 13 behaviors: [I18nBehavior], | 13 behaviors: [I18nBehavior], |
| 14 | 14 |
| 15 properties: { | 15 properties: { |
| 16 /** @private {!VersionInfo} */ | 16 /** @private {!VersionInfo} */ |
| 17 versionInfo_: Object, | 17 versionInfo_: Object, |
| 18 | 18 |
| 19 /** @private */ | 19 /** @private */ |
| 20 currentlyOnChannelText_: String, | 20 currentlyOnChannelText_: String, |
| 21 | 21 |
| 22 /** @private */ | 22 /** @private */ |
| 23 showChannelSwitcherDialog_: Boolean, | 23 showChannelSwitcherDialog_: Boolean, |
| 24 | 24 |
| 25 /** @private */ | 25 /** @private */ |
| 26 canChangeChannel_: { | 26 canChangeChannel_: Boolean, |
| 27 type: Boolean, | |
| 28 value: function() { | |
| 29 return loadTimeData.getBoolean('aboutCanChangeChannel'); | |
| 30 }, | |
| 31 }, | |
| 32 }, | 27 }, |
| 33 | 28 |
| 34 /** @override */ | 29 /** @override */ |
| 35 ready: function() { | 30 ready: function() { |
| 36 var browserProxy = settings.AboutPageBrowserProxyImpl.getInstance(); | 31 var browserProxy = settings.AboutPageBrowserProxyImpl.getInstance(); |
| 37 browserProxy.pageReady(); | 32 browserProxy.pageReady(); |
| 38 | 33 |
| 39 browserProxy.getVersionInfo().then(function(versionInfo) { | 34 browserProxy.getVersionInfo().then(function(versionInfo) { |
| 40 this.versionInfo_ = versionInfo; | 35 this.versionInfo_ = versionInfo; |
| 41 }.bind(this)); | 36 }.bind(this)); |
| 42 browserProxy.getCurrentChannel().then(function(channel) { | 37 |
| 38 this.updateChannelInfo_(); |
| 39 }, |
| 40 |
| 41 /** @private */ |
| 42 updateChannelInfo_: function() { |
| 43 var browserProxy = settings.AboutPageBrowserProxyImpl.getInstance(); |
| 44 browserProxy.getChannelInfo().then(function(info) { |
| 45 // Display the target channel for the 'Currently on' message. |
| 43 this.currentlyOnChannelText_ = this.i18n( | 46 this.currentlyOnChannelText_ = this.i18n( |
| 44 'aboutCurrentlyOnChannel', | 47 'aboutCurrentlyOnChannel', |
| 45 this.i18n(settings.browserChannelToI18nId(channel))); | 48 this.i18n(settings.browserChannelToI18nId(info.targetChannel))); |
| 49 this.canChangeChannel_ = info.canChangeChannel; |
| 46 }.bind(this)); | 50 }.bind(this)); |
| 47 }, | 51 }, |
| 48 | 52 |
| 49 /** | 53 /** |
| 50 * @param {string} version | 54 * @param {string} version |
| 51 * @return {boolean} | 55 * @return {boolean} |
| 52 * @private | 56 * @private |
| 53 */ | 57 */ |
| 54 shouldShowVersion_: function(version) { | 58 shouldShowVersion_: function(version) { |
| 55 return version.length > 0; | 59 return version.length > 0; |
| 56 }, | 60 }, |
| 57 | 61 |
| 58 /** @private */ | 62 /** @private */ |
| 59 onChangeChannelTap_: function() { | 63 onChangeChannelTap_: function() { |
| 60 this.showChannelSwitcherDialog_ = true; | 64 this.showChannelSwitcherDialog_ = true; |
| 61 // Async to wait for dialog to appear in the DOM. | 65 // Async to wait for dialog to appear in the DOM. |
| 62 this.async(function() { | 66 this.async(function() { |
| 63 var dialog = this.$$('settings-channel-switcher-dialog'); | 67 var dialog = this.$$('settings-channel-switcher-dialog'); |
| 64 // Register listener to detect when the dialog is closed. Flip the boolean | 68 // Register listener to detect when the dialog is closed. Flip the boolean |
| 65 // once closed to force a restamp next time it is shown such that the | 69 // once closed to force a restamp next time it is shown such that the |
| 66 // previous dialog's contents are cleared. | 70 // previous dialog's contents are cleared. |
| 67 dialog.addEventListener('close', function() { | 71 dialog.addEventListener('close', function() { |
| 68 this.showChannelSwitcherDialog_ = false; | 72 this.showChannelSwitcherDialog_ = false; |
| 73 this.updateChannelInfo_(); |
| 69 }.bind(this)); | 74 }.bind(this)); |
| 70 }.bind(this)); | 75 }.bind(this)); |
| 71 }, | 76 }, |
| 72 }); | 77 }); |
| OLD | NEW |