| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(rltoscano): This class needs a throbber while loading the destination | 8 // TODO(rltoscano): This class needs a throbber while loading the destination |
| 9 // or another solution is persist the settings of the printer so that next | 9 // or another solution is persist the settings of the printer so that next |
| 10 // load is fast. | 10 // load is fast. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * @private | 25 * @private |
| 26 */ | 26 */ |
| 27 this.destinationStore_ = destinationStore; | 27 this.destinationStore_ = destinationStore; |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * Current CSS class of the destination icon. | 30 * Current CSS class of the destination icon. |
| 31 * @type {?DestinationSettings.Classes_} | 31 * @type {?DestinationSettings.Classes_} |
| 32 * @private | 32 * @private |
| 33 */ | 33 */ |
| 34 this.iconClass_ = null; | 34 this.iconClass_ = null; |
| 35 }; | 35 } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Event types dispatched by the component. | 38 * Event types dispatched by the component. |
| 39 * @enum {string} | 39 * @enum {string} |
| 40 */ | 40 */ |
| 41 DestinationSettings.EventType = { | 41 DestinationSettings.EventType = { |
| 42 CHANGE_BUTTON_ACTIVATE: | 42 CHANGE_BUTTON_ACTIVATE: |
| 43 'print_preview.DestinationSettings.CHANGE_BUTTON_ACTIVATE' | 43 'print_preview.DestinationSettings.CHANGE_BUTTON_ACTIVATE' |
| 44 }; | 44 }; |
| 45 | 45 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 offlineStatusEl.title = offlineStatusText; | 143 offlineStatusEl.title = offlineStatusText; |
| 144 | 144 |
| 145 var isOffline = destination.isOffline; | 145 var isOffline = destination.isOffline; |
| 146 destinationSettingsBoxEl.classList.toggle( | 146 destinationSettingsBoxEl.classList.toggle( |
| 147 DestinationSettings.Classes_.STALE, isOffline); | 147 DestinationSettings.Classes_.STALE, isOffline); |
| 148 setIsVisible(locationEl, !isOffline); | 148 setIsVisible(locationEl, !isOffline); |
| 149 setIsVisible(offlineStatusEl, isOffline); | 149 setIsVisible(offlineStatusEl, isOffline); |
| 150 } | 150 } |
| 151 | 151 |
| 152 setIsVisible( | 152 setIsVisible( |
| 153 this.getChildElement('.throbber-container'), | 153 assert(this.getChildElement('.throbber-container')), |
| 154 this.destinationStore_.isAutoSelectDestinationInProgress); | 154 this.destinationStore_.isAutoSelectDestinationInProgress); |
| 155 setIsVisible(destinationSettingsBoxEl, !!destination); | 155 setIsVisible(assert(destinationSettingsBoxEl), !!destination); |
| 156 }, | 156 }, |
| 157 | 157 |
| 158 onSelectedDestinationNameSet_: function() { | 158 onSelectedDestinationNameSet_: function() { |
| 159 var destinationName = | 159 var destinationName = |
| 160 this.destinationStore_.selectedDestination.displayName; | 160 this.destinationStore_.selectedDestination.displayName; |
| 161 var nameEl = this.getElement().getElementsByClassName( | 161 var nameEl = this.getElement().getElementsByClassName( |
| 162 DestinationSettings.Classes_.THOBBER_NAME)[0]; | 162 DestinationSettings.Classes_.THOBBER_NAME)[0]; |
| 163 nameEl.textContent = destinationName; | 163 nameEl.textContent = destinationName; |
| 164 nameEl.title = destinationName; | 164 nameEl.title = destinationName; |
| 165 } | 165 } |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 // Export | 168 // Export |
| 169 return { | 169 return { |
| 170 DestinationSettings: DestinationSettings | 170 DestinationSettings: DestinationSettings |
| 171 }; | 171 }; |
| 172 }); | 172 }); |
| OLD | NEW |