| 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-channel-switcher-dialog' is a component allowing the | 6 * @fileoverview 'settings-channel-switcher-dialog' is a component allowing the |
| 7 * user to switch between release channels (dev, beta, stable). A | 7 * user to switch between release channels (dev, beta, stable). A |
| 8 * |target-channel-changed| event is fired if the user does select a different | 8 * |target-channel-changed| event is fired if the user does select a different |
| 9 * release channel to notify parents of this dialog. | 9 * release channel to notify parents of this dialog. |
| 10 */ | 10 */ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 this.browserProxy_.getCurrentChannel().then(function(channel) { | 49 this.browserProxy_.getCurrentChannel().then(function(channel) { |
| 50 this.currentChannel_ = channel; | 50 this.currentChannel_ = channel; |
| 51 // Pre-populate radio group with current channel. | 51 // Pre-populate radio group with current channel. |
| 52 this.$$('paper-radio-group').select(channel); | 52 this.$$('paper-radio-group').select(channel); |
| 53 }.bind(this)); | 53 }.bind(this)); |
| 54 }, | 54 }, |
| 55 | 55 |
| 56 /** @override */ | 56 /** @override */ |
| 57 attached: function() { | 57 attached: function() { |
| 58 this.$.dialog.open(); | 58 this.$.dialog.showModal(); |
| 59 }, | 59 }, |
| 60 | 60 |
| 61 /** @private */ | 61 /** @private */ |
| 62 onCancelTap_: function() { | 62 onCancelTap_: function() { |
| 63 this.$.dialog.close(); | 63 this.$.dialog.close(); |
| 64 }, | 64 }, |
| 65 | 65 |
| 66 /** @private */ | 66 /** @private */ |
| 67 onChangeChannelTap_: function() { | 67 onChangeChannelTap_: function() { |
| 68 var selectedChannel = this.$$('paper-radio-group').selected; | 68 var selectedChannel = this.$$('paper-radio-group').selected; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 }; | 114 }; |
| 115 }, | 115 }, |
| 116 | 116 |
| 117 /** @private */ | 117 /** @private */ |
| 118 onChannelSelectionChanged_: function() { | 118 onChannelSelectionChanged_: function() { |
| 119 var selectedChannel = this.$$('paper-radio-group').selected; | 119 var selectedChannel = this.$$('paper-radio-group').selected; |
| 120 | 120 |
| 121 if (selectedChannel == this.currentChannel_) { | 121 if (selectedChannel == this.currentChannel_) { |
| 122 this.shouldShowButtons_ = null; | 122 this.shouldShowButtons_ = null; |
| 123 this.warning_ = null; | 123 this.warning_ = null; |
| 124 this.$.dialog.notifyResize(); | |
| 125 return; | 124 return; |
| 126 } | 125 } |
| 127 | 126 |
| 128 if (settings.isTargetChannelMoreStable( | 127 if (settings.isTargetChannelMoreStable( |
| 129 this.currentChannel_, selectedChannel)) { | 128 this.currentChannel_, selectedChannel)) { |
| 130 if (loadTimeData.getBoolean('aboutEnterpriseManaged')) { | 129 if (loadTimeData.getBoolean('aboutEnterpriseManaged')) { |
| 131 this.updateWarning_( | 130 this.updateWarning_( |
| 132 'aboutDelayedWarningTitle', | 131 'aboutDelayedWarningTitle', |
| 133 'aboutDelayedWarningMessage', | 132 'aboutDelayedWarningMessage', |
| 134 'aboutProductTitle'); | 133 'aboutProductTitle'); |
| 135 this.updateButtons_(true, false); | 134 this.updateButtons_(true, false); |
| 136 } else { | 135 } else { |
| 137 this.updateWarning_( | 136 this.updateWarning_( |
| 138 'aboutPowerwashWarningTitle', 'aboutPowerwashWarningMessage'); | 137 'aboutPowerwashWarningTitle', 'aboutPowerwashWarningMessage'); |
| 139 this.updateButtons_(false, true); | 138 this.updateButtons_(false, true); |
| 140 } | 139 } |
| 141 } else { | 140 } else { |
| 142 this.updateWarning_( | 141 this.updateWarning_( |
| 143 'aboutUnstableWarningTitle', | 142 'aboutUnstableWarningTitle', |
| 144 'aboutUnstableWarningMessage', | 143 'aboutUnstableWarningMessage', |
| 145 'aboutProductTitle'); | 144 'aboutProductTitle'); |
| 146 this.updateButtons_(true, false); | 145 this.updateButtons_(true, false); |
| 147 } | 146 } |
| 148 this.$.dialog.notifyResize(); | |
| 149 }, | 147 }, |
| 150 | 148 |
| 151 /** | 149 /** |
| 152 * @return {boolean} | 150 * @return {boolean} |
| 153 * @private | 151 * @private |
| 154 */ | 152 */ |
| 155 shouldShowWarning_: function() { | 153 shouldShowWarning_: function() { |
| 156 return this.warning_ !== null; | 154 return this.warning_ !== null; |
| 157 }, | 155 }, |
| 158 }); | 156 }); |
| OLD | NEW |