| Index: chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings.js
|
| diff --git a/chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings.js b/chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings.js
|
| index f30f20382e468e6fa47d05340de19fe3839c4ac0..13f38c3d372047adc781c376dbb256b123876a99 100644
|
| --- a/chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings.js
|
| +++ b/chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings.js
|
| @@ -66,6 +66,11 @@ cr.define('print_preview', function() {
|
| this.cancel.bind(this));
|
|
|
| this.tracker.add(
|
| + this.getChildElement('#done-button'),
|
| + 'click',
|
| + this.onApplySettings_.bind(this));
|
| +
|
| + this.tracker.add(
|
| this.searchBox_,
|
| print_preview.SearchBox.EventType.SEARCH,
|
| this.onSearch_.bind(this));
|
| @@ -95,6 +100,14 @@ cr.define('print_preview', function() {
|
| ADVANCED_SETTINGS_DIALOG_CANCELED);
|
| },
|
|
|
| + /** @override */
|
| + onEnterPressedInternal: function() {
|
| + var doneButton = this.getChildElement('#done-button');
|
| + if (!doneButton.disabled)
|
| + doneButton.click();
|
| + return !doneButton.disabled;
|
| + },
|
| +
|
| /**
|
| * @return {number} Height available for settings, in pixels.
|
| * @private
|
| @@ -136,11 +149,7 @@ cr.define('print_preview', function() {
|
| }.bind(this));
|
| this.items_ = [];
|
|
|
| - var vendorCapabilities =
|
| - this.destination_ &&
|
| - this.destination_.capabilities &&
|
| - this.destination_.capabilities.printer &&
|
| - this.destination_.capabilities.printer.vendor_capability;
|
| + var vendorCapabilities = this.printTicketStore_.vendorItems.capability;
|
| if (!vendorCapabilities)
|
| return;
|
|
|
| @@ -165,6 +174,22 @@ cr.define('print_preview', function() {
|
| */
|
| onSearch_: function(evt) {
|
| this.filterLists_(evt.query);
|
| + },
|
| +
|
| + /**
|
| + * Called when current settings selection need to be stored in the ticket.
|
| + * @private
|
| + */
|
| + onApplySettings_: function(evt) {
|
| + this.setIsVisible(false);
|
| +
|
| + var values = {};
|
| + this.items_.forEach(function(item) {
|
| + if (item.isModified())
|
| + values[item.id] = item.selectedValue;
|
| + }.bind(this));
|
| +
|
| + this.printTicketStore_.vendorItems.updateValue(values);
|
| }
|
| };
|
|
|
|
|