 Chromium Code Reviews
 Chromium Code Reviews Issue 2538043006:
  Settings: About: Fix cros channel info.  (Closed)
    
  
    Issue 2538043006:
  Settings: About: Fix cros channel info.  (Closed) 
  | 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.getChannel(); | |
| 
dpapad
2016/12/05 18:52:27
It took me a second to realize that |getChannel| a
 
stevenjb
2016/12/06 20:38:02
Done.
 | |
| 39 | |
| 40 browserProxy.getCanChangeChannel().then(function(canChangeChannel) { | |
| 41 this.canChangeChannel_ = canChangeChannel; | |
| 42 }.bind(this)); | |
| 43 }, | |
| 44 | |
| 45 /** @private */ | |
| 46 getChannel: function() { | |
| 
dpapad
2016/12/05 18:52:27
Private methods should end with "_" suffix.
 
stevenjb
2016/12/06 20:38:02
Done.
 | |
| 47 var browserProxy = settings.AboutPageBrowserProxyImpl.getInstance(); | |
| 48 // We actually display the target channel for the 'Currently on' message. | |
| 
dpapad
2016/12/05 18:52:27
Nit: s/We actually d/D/
 
stevenjb
2016/12/06 20:38:02
Done.
 | |
| 49 browserProxy.getTargetChannel().then(function(channel) { | |
| 43 this.currentlyOnChannelText_ = this.i18n( | 50 this.currentlyOnChannelText_ = this.i18n( | 
| 44 'aboutCurrentlyOnChannel', | 51 'aboutCurrentlyOnChannel', | 
| 45 this.i18n(settings.browserChannelToI18nId(channel))); | 52 this.i18n(settings.browserChannelToI18nId(channel))); | 
| 46 }.bind(this)); | 53 }.bind(this)); | 
| 47 }, | 54 }, | 
| 48 | 55 | 
| 49 /** | 56 /** | 
| 50 * @param {string} version | 57 * @param {string} version | 
| 51 * @return {boolean} | 58 * @return {boolean} | 
| 52 * @private | 59 * @private | 
| 53 */ | 60 */ | 
| 54 shouldShowVersion_: function(version) { | 61 shouldShowVersion_: function(version) { | 
| 55 return version.length > 0; | 62 return version.length > 0; | 
| 56 }, | 63 }, | 
| 57 | 64 | 
| 58 /** @private */ | 65 /** @private */ | 
| 59 onChangeChannelTap_: function() { | 66 onChangeChannelTap_: function() { | 
| 60 this.showChannelSwitcherDialog_ = true; | 67 this.showChannelSwitcherDialog_ = true; | 
| 61 // Async to wait for dialog to appear in the DOM. | 68 // Async to wait for dialog to appear in the DOM. | 
| 62 this.async(function() { | 69 this.async(function() { | 
| 63 var dialog = this.$$('settings-channel-switcher-dialog'); | 70 var dialog = this.$$('settings-channel-switcher-dialog'); | 
| 64 // Register listener to detect when the dialog is closed. Flip the boolean | 71 // 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 | 72 // once closed to force a restamp next time it is shown such that the | 
| 66 // previous dialog's contents are cleared. | 73 // previous dialog's contents are cleared. | 
| 67 dialog.addEventListener('close', function() { | 74 dialog.addEventListener('close', function() { | 
| 68 this.showChannelSwitcherDialog_ = false; | 75 this.showChannelSwitcherDialog_ = false; | 
| 76 this.getChannel(); | |
| 69 }.bind(this)); | 77 }.bind(this)); | 
| 70 }.bind(this)); | 78 }.bind(this)); | 
| 71 }, | 79 }, | 
| 72 }); | 80 }); | 
| OLD | NEW |