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 * Print options section to control printer advanced options. | 9 * Print options section to control printer advanced options. |
10 * @param {!print_preview.ticket_items.VendorItems} ticketItem Ticket item to | 10 * @param {!print_preview.ticket_items.VendorItems} ticketItem Ticket item to |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 /** @param {boolean} isEnabled Whether the component is enabled. */ | 54 /** @param {boolean} isEnabled Whether the component is enabled. */ |
55 set isEnabled(isEnabled) { | 55 set isEnabled(isEnabled) { |
56 this.getButton_().disabled = !isEnabled; | 56 this.getButton_().disabled = !isEnabled; |
57 }, | 57 }, |
58 | 58 |
59 /** @override */ | 59 /** @override */ |
60 enterDocument: function() { | 60 enterDocument: function() { |
61 print_preview.SettingsSection.prototype.enterDocument.call(this); | 61 print_preview.SettingsSection.prototype.enterDocument.call(this); |
62 | 62 |
63 this.tracker.add( | 63 this.tracker.add(this.getButton_(), 'click', function() { |
64 this.getButton_(), 'click', function() { | 64 cr.dispatchSimpleEvent( |
65 cr.dispatchSimpleEvent( | 65 this, AdvancedOptionsSettings.EventType.BUTTON_ACTIVATED); |
66 this, AdvancedOptionsSettings.EventType.BUTTON_ACTIVATED); | 66 }.bind(this)); |
67 }.bind(this)); | |
68 this.tracker.add( | 67 this.tracker.add( |
69 this.destinationStore_, | 68 this.destinationStore_, |
70 print_preview.DestinationStore.EventType.DESTINATION_SELECT, | 69 print_preview.DestinationStore.EventType.DESTINATION_SELECT, |
71 this.onDestinationChanged_.bind(this)); | 70 this.onDestinationChanged_.bind(this)); |
72 this.tracker.add( | 71 this.tracker.add( |
73 this.destinationStore_, | 72 this.destinationStore_, |
74 print_preview.DestinationStore.EventType. | 73 print_preview.DestinationStore.EventType |
75 SELECTED_DESTINATION_CAPABILITIES_READY, | 74 .SELECTED_DESTINATION_CAPABILITIES_READY, |
76 this.onDestinationChanged_.bind(this)); | 75 this.onDestinationChanged_.bind(this)); |
77 }, | 76 }, |
78 | 77 |
79 /** | 78 /** |
80 * @return {!HTMLElement} | 79 * @return {!HTMLElement} |
81 * @private | 80 * @private |
82 */ | 81 */ |
83 getButton_: function() { | 82 getButton_: function() { |
84 return this.getChildElement('.advanced-options-settings-button'); | 83 return this.getChildElement('.advanced-options-settings-button'); |
85 }, | 84 }, |
86 | 85 |
87 /** | 86 /** |
88 * Called when the destination selection has changed. Updates UI elements. | 87 * Called when the destination selection has changed. Updates UI elements. |
89 * @private | 88 * @private |
90 */ | 89 */ |
91 onDestinationChanged_: function() { | 90 onDestinationChanged_: function() { |
92 this.updateUiStateInternal(); | 91 this.updateUiStateInternal(); |
93 } | 92 } |
94 }; | 93 }; |
95 | 94 |
96 // Export | 95 // Export |
97 return { | 96 return {AdvancedOptionsSettings: AdvancedOptionsSettings}; |
98 AdvancedOptionsSettings: AdvancedOptionsSettings | |
99 }; | |
100 }); | 97 }); |
OLD | NEW |