| 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. |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Component used to render the print destination. | 13 * Component used to render the print destination. |
| 14 * @param {!print_preview.DestinationStore} destinationStore Used to determine | 14 * @param {!print_preview.DestinationStore} destinationStore Used to determine |
| 15 * the selected destination. | 15 * the selected destination. |
| 16 * @constructor | 16 * @constructor |
| 17 * @extends {print_preview.Component} | 17 * @extends {print_preview.SettingsSection} |
| 18 */ | 18 */ |
| 19 function DestinationSettings(destinationStore) { | 19 function DestinationSettings(destinationStore) { |
| 20 print_preview.Component.call(this); | 20 print_preview.SettingsSection.call(this); |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Used to determine the selected destination. | 23 * Used to determine the selected destination. |
| 24 * @type {!print_preview.DestinationStore} | 24 * @type {!print_preview.DestinationStore} |
| 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. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 ICON_LOCAL: 'destination-settings-icon-local', | 57 ICON_LOCAL: 'destination-settings-icon-local', |
| 58 ICON_MOBILE: 'destination-settings-icon-mobile', | 58 ICON_MOBILE: 'destination-settings-icon-mobile', |
| 59 ICON_MOBILE_SHARED: 'destination-settings-icon-mobile-shared', | 59 ICON_MOBILE_SHARED: 'destination-settings-icon-mobile-shared', |
| 60 LOCATION: 'destination-settings-location', | 60 LOCATION: 'destination-settings-location', |
| 61 NAME: 'destination-settings-name', | 61 NAME: 'destination-settings-name', |
| 62 STALE: 'stale', | 62 STALE: 'stale', |
| 63 THOBBER_NAME: 'destination-throbber-name' | 63 THOBBER_NAME: 'destination-throbber-name' |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 DestinationSettings.prototype = { | 66 DestinationSettings.prototype = { |
| 67 __proto__: print_preview.Component.prototype, | 67 __proto__: print_preview.SettingsSection.prototype, |
| 68 | 68 |
| 69 /** @param {boolean} Whether the component is enabled. */ | 69 /** @override */ |
| 70 isAvailable: function() { |
| 71 return true; |
| 72 }, |
| 73 |
| 74 /** @override */ |
| 75 hasCollapsibleContent: function() { |
| 76 return false; |
| 77 }, |
| 78 |
| 79 /** @override */ |
| 70 set isEnabled(isEnabled) { | 80 set isEnabled(isEnabled) { |
| 71 var changeButton = this.getElement().getElementsByClassName( | 81 var changeButton = this.getElement().getElementsByClassName( |
| 72 DestinationSettings.Classes_.CHANGE_BUTTON)[0]; | 82 DestinationSettings.Classes_.CHANGE_BUTTON)[0]; |
| 73 changeButton.disabled = !isEnabled; | 83 changeButton.disabled = !isEnabled; |
| 74 }, | 84 }, |
| 75 | 85 |
| 76 /** @override */ | 86 /** @override */ |
| 77 enterDocument: function() { | 87 enterDocument: function() { |
| 78 print_preview.Component.prototype.enterDocument.call(this); | 88 print_preview.SettingsSection.prototype.enterDocument.call(this); |
| 79 var changeButton = this.getElement().getElementsByClassName( | 89 var changeButton = this.getElement().getElementsByClassName( |
| 80 DestinationSettings.Classes_.CHANGE_BUTTON)[0]; | 90 DestinationSettings.Classes_.CHANGE_BUTTON)[0]; |
| 81 this.tracker.add( | 91 this.tracker.add( |
| 82 changeButton, 'click', this.onChangeButtonClick_.bind(this)); | 92 changeButton, 'click', this.onChangeButtonClick_.bind(this)); |
| 83 this.tracker.add( | 93 this.tracker.add( |
| 84 this.destinationStore_, | 94 this.destinationStore_, |
| 85 print_preview.DestinationStore.EventType.DESTINATION_SELECT, | 95 print_preview.DestinationStore.EventType.DESTINATION_SELECT, |
| 86 this.onDestinationSelect_.bind(this)); | 96 this.onDestinationSelect_.bind(this)); |
| 87 this.tracker_.add( | 97 this.tracker_.add( |
| 88 this.destinationStore_, | 98 this.destinationStore_, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 nameEl.textContent = destinationName; | 163 nameEl.textContent = destinationName; |
| 154 nameEl.title = destinationName; | 164 nameEl.title = destinationName; |
| 155 } | 165 } |
| 156 }; | 166 }; |
| 157 | 167 |
| 158 // Export | 168 // Export |
| 159 return { | 169 return { |
| 160 DestinationSettings: DestinationSettings | 170 DestinationSettings: DestinationSettings |
| 161 }; | 171 }; |
| 162 }); | 172 }); |
| OLD | NEW |