| 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 * Modal dialog for print destination's advanced settings. | 9 * Modal dialog for print destination's advanced settings. |
| 10 * @param {!print_preview.PrintTicketStore} printTicketStore Contains the | 10 * @param {!print_preview.PrintTicketStore} printTicketStore Contains the |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 __proto__: print_preview.Overlay.prototype, | 52 __proto__: print_preview.Overlay.prototype, |
| 53 | 53 |
| 54 /** | 54 /** |
| 55 * @param {!print_preview.Destination} destination Destination to show | 55 * @param {!print_preview.Destination} destination Destination to show |
| 56 * advanced settings for. | 56 * advanced settings for. |
| 57 */ | 57 */ |
| 58 showForDestination: function(destination) { | 58 showForDestination: function(destination) { |
| 59 assert(!this.destination_); | 59 assert(!this.destination_); |
| 60 this.destination_ = destination; | 60 this.destination_ = destination; |
| 61 this.getChildElement('.advanced-settings-title').textContent = | 61 this.getChildElement('.advanced-settings-title').textContent = |
| 62 loadTimeData.getStringF('advancedSettingsDialogTitle', | 62 loadTimeData.getStringF( |
| 63 this.destination_.displayName); | 63 'advancedSettingsDialogTitle', this.destination_.displayName); |
| 64 this.setIsVisible(true); | 64 this.setIsVisible(true); |
| 65 this.renderSettings_(); | 65 this.renderSettings_(); |
| 66 }, | 66 }, |
| 67 | 67 |
| 68 /** @override */ | 68 /** @override */ |
| 69 enterDocument: function() { | 69 enterDocument: function() { |
| 70 print_preview.Overlay.prototype.enterDocument.call(this); | 70 print_preview.Overlay.prototype.enterDocument.call(this); |
| 71 | 71 |
| 72 this.tracker.add( | 72 this.tracker.add( |
| 73 this.getChildElement('.button-strip .cancel-button'), | 73 this.getChildElement('.button-strip .cancel-button'), 'click', |
| 74 'click', | |
| 75 this.cancel.bind(this)); | 74 this.cancel.bind(this)); |
| 76 | 75 |
| 77 this.tracker.add( | 76 this.tracker.add( |
| 78 this.getChildElement('.button-strip .done-button'), | 77 this.getChildElement('.button-strip .done-button'), 'click', |
| 79 'click', | |
| 80 this.onApplySettings_.bind(this)); | 78 this.onApplySettings_.bind(this)); |
| 81 | 79 |
| 82 this.tracker.add( | 80 this.tracker.add( |
| 83 this.searchBox_, | 81 this.searchBox_, print_preview.SearchBox.EventType.SEARCH, |
| 84 print_preview.SearchBox.EventType.SEARCH, | |
| 85 this.onSearch_.bind(this)); | 82 this.onSearch_.bind(this)); |
| 86 }, | 83 }, |
| 87 | 84 |
| 88 /** @override */ | 85 /** @override */ |
| 89 decorateInternal: function() { | 86 decorateInternal: function() { |
| 90 this.searchBox_.render(this.getChildElement('.search-box-area')); | 87 this.searchBox_.render(this.getChildElement('.search-box-area')); |
| 91 }, | 88 }, |
| 92 | 89 |
| 93 /** @override */ | 90 /** @override */ |
| 94 onSetVisibleInternal: function(isVisible) { | 91 onSetVisibleInternal: function(isVisible) { |
| 95 if (isVisible) { | 92 if (isVisible) { |
| 96 this.searchBox_.focus(); | 93 this.searchBox_.focus(); |
| 97 this.metrics_.record(print_preview.Metrics.PrintSettingsUiBucket. | 94 this.metrics_.record(print_preview.Metrics.PrintSettingsUiBucket |
| 98 ADVANCED_SETTINGS_DIALOG_SHOWN); | 95 .ADVANCED_SETTINGS_DIALOG_SHOWN); |
| 99 } else { | 96 } else { |
| 100 this.resetSearch_(); | 97 this.resetSearch_(); |
| 101 this.destination_ = null; | 98 this.destination_ = null; |
| 102 } | 99 } |
| 103 }, | 100 }, |
| 104 | 101 |
| 105 /** @override */ | 102 /** @override */ |
| 106 onCancelInternal: function() { | 103 onCancelInternal: function() { |
| 107 this.metrics_.record(print_preview.Metrics.PrintSettingsUiBucket. | 104 this.metrics_.record(print_preview.Metrics.PrintSettingsUiBucket |
| 108 ADVANCED_SETTINGS_DIALOG_CANCELED); | 105 .ADVANCED_SETTINGS_DIALOG_CANCELED); |
| 109 }, | 106 }, |
| 110 | 107 |
| 111 /** @override */ | 108 /** @override */ |
| 112 onEnterPressedInternal: function() { | 109 onEnterPressedInternal: function() { |
| 113 var doneButton = this.getChildElement('.button-strip .done-button'); | 110 var doneButton = this.getChildElement('.button-strip .done-button'); |
| 114 if (!doneButton.disabled) | 111 if (!doneButton.disabled) |
| 115 doneButton.click(); | 112 doneButton.click(); |
| 116 return !doneButton.disabled; | 113 return !doneButton.disabled; |
| 117 }, | 114 }, |
| 118 | 115 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 this.items_.forEach(function(item) { | 224 this.items_.forEach(function(item) { |
| 228 if (item.isModified()) | 225 if (item.isModified()) |
| 229 values[item.id] = item.selectedValue; | 226 values[item.id] = item.selectedValue; |
| 230 }.bind(this)); | 227 }.bind(this)); |
| 231 | 228 |
| 232 this.printTicketStore_.vendorItems.updateValue(values); | 229 this.printTicketStore_.vendorItems.updateValue(values); |
| 233 } | 230 } |
| 234 }; | 231 }; |
| 235 | 232 |
| 236 // Export | 233 // Export |
| 237 return { | 234 return {AdvancedSettings: AdvancedSettings}; |
| 238 AdvancedSettings: AdvancedSettings | |
| 239 }; | |
| 240 }); | 235 }); |
| OLD | NEW |