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_item.VendorItems} ticketItem Ticket item to | 10 * @param {!print_preview.ticket_items.VendorItems} ticketItem Ticket item to |
11 * check settings availability. | 11 * check settings availability. |
12 * @param {!print_preview.DestinationStore} destinationStore Used to determine | 12 * @param {!print_preview.DestinationStore} destinationStore Used to determine |
13 * the selected destination. | 13 * the selected destination. |
14 * @constructor | 14 * @constructor |
15 * @extends {print_preview.SettingsSection} | 15 * @extends {print_preview.SettingsSection} |
16 */ | 16 */ |
17 function AdvancedOptionsSettings(ticketItem, destinationStore) { | 17 function AdvancedOptionsSettings(ticketItem, destinationStore) { |
18 print_preview.SettingsSection.call(this); | 18 print_preview.SettingsSection.call(this); |
19 | 19 |
20 /** | 20 /** |
21 * Ticket item to check settings availability. | 21 * Ticket item to check settings availability. |
22 * @private {!print_preview.ticket_items.VendorItems} | 22 * @private {!print_preview.ticket_items.VendorItems} |
23 */ | 23 */ |
24 this.ticketItem_ = ticketItem; | 24 this.ticketItem_ = ticketItem; |
25 | 25 |
26 /** | 26 /** |
27 * Used to determine the selected destination. | 27 * Used to determine the selected destination. |
28 * @private {!print_preview.DestinationStore} | 28 * @private {!print_preview.DestinationStore} |
29 */ | 29 */ |
30 this.destinationStore_ = destinationStore; | 30 this.destinationStore_ = destinationStore; |
31 }; | 31 } |
32 | 32 |
33 /** | 33 /** |
34 * Event types dispatched by the component. | 34 * Event types dispatched by the component. |
35 * @enum {string} | 35 * @enum {string} |
36 */ | 36 */ |
37 AdvancedOptionsSettings.EventType = { | 37 AdvancedOptionsSettings.EventType = { |
38 BUTTON_ACTIVATED: 'print_preview.AdvancedOptionsSettings.BUTTON_ACTIVATED' | 38 BUTTON_ACTIVATED: 'print_preview.AdvancedOptionsSettings.BUTTON_ACTIVATED' |
39 }; | 39 }; |
40 | 40 |
41 AdvancedOptionsSettings.prototype = { | 41 AdvancedOptionsSettings.prototype = { |
(...skipping 12 matching lines...) Expand all Loading... | |
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( |
64 this.getButton_(), 'click', function() { | 64 assert(this.getButton_()), 'click', function() { |
dpapad
2017/05/04 01:20:04
Instead of asserting here, can we change getButton
rbpotter
2017/05/04 01:43:06
Done.
| |
65 cr.dispatchSimpleEvent( | 65 cr.dispatchSimpleEvent( |
66 this, AdvancedOptionsSettings.EventType.BUTTON_ACTIVATED); | 66 this, AdvancedOptionsSettings.EventType.BUTTON_ACTIVATED); |
67 }.bind(this)); | 67 }.bind(this)); |
68 this.tracker.add( | 68 this.tracker.add( |
69 this.destinationStore_, | 69 this.destinationStore_, |
70 print_preview.DestinationStore.EventType.DESTINATION_SELECT, | 70 print_preview.DestinationStore.EventType.DESTINATION_SELECT, |
71 this.onDestinationChanged_.bind(this)); | 71 this.onDestinationChanged_.bind(this)); |
72 this.tracker.add( | 72 this.tracker.add( |
73 this.destinationStore_, | 73 this.destinationStore_, |
74 print_preview.DestinationStore.EventType. | 74 print_preview.DestinationStore.EventType. |
(...skipping 16 matching lines...) Expand all Loading... | |
91 onDestinationChanged_: function() { | 91 onDestinationChanged_: function() { |
92 this.updateUiStateInternal(); | 92 this.updateUiStateInternal(); |
93 } | 93 } |
94 }; | 94 }; |
95 | 95 |
96 // Export | 96 // Export |
97 return { | 97 return { |
98 AdvancedOptionsSettings: AdvancedOptionsSettings | 98 AdvancedOptionsSettings: AdvancedOptionsSettings |
99 }; | 99 }; |
100 }); | 100 }); |
OLD | NEW |