| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Toggles visibility of the specified printing options sections. | 9 * Toggles visibility of the specified printing options sections. |
| 10 * @param {!print_preview.DestinationStore} destinationStore To listen for | 10 * @param {!print_preview.DestinationStore} destinationStore To listen for |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 }, | 116 }, |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * Updates the component appearance according to the current state. | 119 * Updates the component appearance according to the current state. |
| 120 * @param {boolean} noAnimation Whether section visibility transitions | 120 * @param {boolean} noAnimation Whether section visibility transitions |
| 121 * should not be animated. | 121 * should not be animated. |
| 122 * @private | 122 * @private |
| 123 */ | 123 */ |
| 124 updateState_: function(noAnimation) { | 124 updateState_: function(noAnimation) { |
| 125 if (!this.firstDestinationReady_) { | 125 if (!this.firstDestinationReady_) { |
| 126 fadeOutElement(this.getElement(), noAnimation); | 126 fadeOutElement(this.getElement()); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 // When capabilities are not known yet, don't change the state to avoid | 129 // When capabilities are not known yet, don't change the state to avoid |
| 130 // unnecessary fade in/out cycles. | 130 // unnecessary fade in/out cycles. |
| 131 if (!this.capabilitiesReady_) | 131 if (!this.capabilitiesReady_) |
| 132 return; | 132 return; |
| 133 | 133 |
| 134 var all = this.settingsToShow_ == MoreSettings.SettingsToShow.ALL; | 134 var all = this.settingsToShow_ == MoreSettings.SettingsToShow.ALL; |
| 135 this.getChildElement('.more-settings-label').textContent = | 135 this.getChildElement('.more-settings-label').textContent = |
| 136 loadTimeData.getString(all ? 'lessOptionsLabel' : 'moreOptionsLabel'); | 136 loadTimeData.getString(all ? 'lessOptionsLabel' : 'moreOptionsLabel'); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 147 // manageable and not too crowded. | 147 // manageable and not too crowded. |
| 148 var hasSectionsToToggle = | 148 var hasSectionsToToggle = |
| 149 availableSections > 6 && | 149 availableSections > 6 && |
| 150 this.settingsSections_.some(function(section) { | 150 this.settingsSections_.some(function(section) { |
| 151 return section.hasCollapsibleContent(); | 151 return section.hasCollapsibleContent(); |
| 152 }); | 152 }); |
| 153 | 153 |
| 154 if (hasSectionsToToggle) | 154 if (hasSectionsToToggle) |
| 155 fadeInElement(this.getElement(), noAnimation); | 155 fadeInElement(this.getElement(), noAnimation); |
| 156 else | 156 else |
| 157 fadeOutElement(this.getElement(), noAnimation); | 157 fadeOutElement(this.getElement()); |
| 158 | 158 |
| 159 var collapseContent = | 159 var collapseContent = |
| 160 this.settingsToShow_ == MoreSettings.SettingsToShow.MOST_POPULAR && | 160 this.settingsToShow_ == MoreSettings.SettingsToShow.MOST_POPULAR && |
| 161 hasSectionsToToggle; | 161 hasSectionsToToggle; |
| 162 this.settingsSections_.forEach(function(section) { | 162 this.settingsSections_.forEach(function(section) { |
| 163 section.setCollapseContent(collapseContent, noAnimation); | 163 section.setCollapseContent(collapseContent, noAnimation); |
| 164 }); | 164 }); |
| 165 } | 165 } |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 // Export | 168 // Export |
| 169 return { | 169 return { |
| 170 MoreSettings: MoreSettings | 170 MoreSettings: MoreSettings |
| 171 }; | 171 }; |
| 172 }); | 172 }); |
| OLD | NEW |