OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * Creates a CopiesSettings object. | 9 * Creates a CopiesSettings object. |
10 * @constructor | 10 * @constructor |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 this.updateButtonsState_.bind(this)); | 154 this.updateButtonsState_.bind(this)); |
155 document.addEventListener(customEvents.PRINTER_CAPABILITIES_UPDATED, | 155 document.addEventListener(customEvents.PRINTER_CAPABILITIES_UPDATED, |
156 this.onPrinterCapabilitiesUpdated_.bind(this)); | 156 this.onPrinterCapabilitiesUpdated_.bind(this)); |
157 }, | 157 }, |
158 | 158 |
159 /** | 159 /** |
160 * Executes when a |customEvents.PRINTER_CAPABILITIES_UPDATED| event occurs. | 160 * Executes when a |customEvents.PRINTER_CAPABILITIES_UPDATED| event occurs. |
161 * @private | 161 * @private |
162 */ | 162 */ |
163 onPrinterCapabilitiesUpdated_: function(e) { | 163 onPrinterCapabilitiesUpdated_: function(e) { |
164 if (e.printerCapabilities.disableCopiesOption) { | |
165 fadeOutElement(this.copiesOption_); | |
166 $('hr-before-copies').classList.remove('invisible'); | |
167 } else { | |
168 fadeInElement(this.copiesOption_); | |
169 $('hr-before-copies').classList.add('invisible'); | |
170 } | |
171 this.updateTwoSidedOption_( | 164 this.updateTwoSidedOption_( |
172 e.printerCapabilities.printerDefaultDuplexValue); | 165 e.printerCapabilities.printerDefaultDuplexValue); |
| 166 e.printerCapabilities.disableCopiesOption ? |
| 167 fadeOutOption(this.copiesOption_) : |
| 168 fadeInOption(this.copiesOption_); |
173 }, | 169 }, |
174 | 170 |
175 /** | 171 /** |
176 * Listener triggered when |incrementButton_| is clicked. | 172 * Listener triggered when |incrementButton_| is clicked. |
177 * @private | 173 * @private |
178 */ | 174 */ |
179 onIncrementButtonClicked_: function() { | 175 onIncrementButtonClicked_: function() { |
180 this.onButtonClicked_(1); | 176 this.onButtonClicked_(1); |
181 }, | 177 }, |
182 | 178 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 fadeOutElement(this.hint_); | 234 fadeOutElement(this.hint_); |
239 } | 235 } |
240 this.hint_.setAttribute('aria-hidden', this.isValid()); | 236 this.hint_.setAttribute('aria-hidden', this.isValid()); |
241 } | 237 } |
242 }; | 238 }; |
243 | 239 |
244 return { | 240 return { |
245 CopiesSettings: CopiesSettings, | 241 CopiesSettings: CopiesSettings, |
246 }; | 242 }; |
247 }); | 243 }); |
OLD | NEW |