| 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 |
| 22 /** @private */ |
| 23 showChannelSwitcherDialog_: Boolean, |
| 24 |
| 25 /** @private */ |
| 26 canChangeChannel_: { |
| 27 type: Boolean, |
| 28 value: function() { |
| 29 return loadTimeData.getBoolean('aboutCanChangeChannel'); |
| 30 }, |
| 31 }, |
| 21 }, | 32 }, |
| 22 | 33 |
| 23 /** @override */ | 34 /** @override */ |
| 24 ready: function() { | 35 ready: function() { |
| 25 var browserProxy = settings.AboutPageBrowserProxyImpl.getInstance(); | 36 var browserProxy = settings.AboutPageBrowserProxyImpl.getInstance(); |
| 26 browserProxy.pageReady(); | 37 browserProxy.pageReady(); |
| 27 | 38 |
| 28 browserProxy.getVersionInfo().then(function(versionInfo) { | 39 browserProxy.getVersionInfo().then(function(versionInfo) { |
| 29 this.versionInfo_ = versionInfo; | 40 this.versionInfo_ = versionInfo; |
| 30 }.bind(this)); | 41 }.bind(this)); |
| 31 browserProxy.getCurrentChannel().then(function(channel) { | 42 browserProxy.getCurrentChannel().then(function(channel) { |
| 32 this.currentlyOnChannelText_ = this.i18n( | 43 this.currentlyOnChannelText_ = this.i18n( |
| 33 'aboutCurrentlyOnChannel', | 44 'aboutCurrentlyOnChannel', |
| 34 this.i18n(settings.browserChannelToI18nId(channel))); | 45 this.i18n(settings.browserChannelToI18nId(channel))); |
| 35 }.bind(this)); | 46 }.bind(this)); |
| 36 }, | 47 }, |
| 37 | 48 |
| 38 /** | 49 /** |
| 39 * @param {string} version | 50 * @param {string} version |
| 40 * @return {boolean} | 51 * @return {boolean} |
| 41 * @private | 52 * @private |
| 42 */ | 53 */ |
| 43 shouldShowVersion_: function(version) { | 54 shouldShowVersion_: function(version) { |
| 44 return version.length > 0; | 55 return version.length > 0; |
| 45 }, | 56 }, |
| 57 |
| 58 /** @private */ |
| 59 onChangeChannelTap_: function() { |
| 60 this.showChannelSwitcherDialog_ = true; |
| 61 // Async to wait for dialog to appear in the DOM. |
| 62 this.async(function() { |
| 63 var dialog = this.$$('settings-channel-switcher-dialog'); |
| 64 // 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 |
| 66 // previous dialog's contents are cleared. |
| 67 dialog.addEventListener('iron-overlay-closed', function() { |
| 68 this.showChannelSwitcherDialog_ = false; |
| 69 }.bind(this)); |
| 70 }.bind(this)); |
| 71 }, |
| 46 }); | 72 }); |
| OLD | NEW |