| Index: chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js
|
| diff --git a/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js b/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js
|
| index 5b727bcfa674930a42a16800f7446a25bbcf6d24..8eac7292fdceea9b7b5557d3c8ad16d0935340ed 100644
|
| --- a/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js
|
| +++ b/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js
|
| @@ -110,10 +110,10 @@ Polymer({
|
| },
|
|
|
| /** @private */
|
| - switchToConfiguringDialog_: function() {
|
| + switchToManufacturerDialog_: function() {
|
| this.stopDiscoveringPrinters_();
|
| this.$$('add-printer-dialog').close();
|
| - this.fire('open-configuring-printer-dialog');
|
| + this.fire('open-manufacturer-model-dialog');
|
| },
|
| });
|
|
|
| @@ -183,12 +183,24 @@ Polymer({
|
| is: 'add-printer-manufacturer-model-dialog',
|
|
|
| properties: {
|
| - /** @type {!CupsPrinterInfo} */
|
| + /**
|
| + * The printer object from 'add-printer-manually-dialog'.
|
| + * @type {!CupsPrinterInfo}
|
| + */
|
| newPrinter: {
|
| type: Object,
|
| notify: true,
|
| },
|
|
|
| + /**
|
| + * The printer object from 'add-printer-discovery-dialog'.
|
| + * @type {!CupsPrinterInfo}
|
| + */
|
| + selectedPrinter: {
|
| + type: Object,
|
| + notify: true,
|
| + },
|
| +
|
| /** @type {?Array<string>} */
|
| manufacturerList: {
|
| type: Array,
|
| @@ -203,10 +215,33 @@ Polymer({
|
| type: Boolean,
|
| value: false,
|
| },
|
| +
|
| + inManualFlow: {
|
| + type: Boolean,
|
| + },
|
| +
|
| + /** @private {string} */
|
| + printerManufacturer_: {
|
| + type: String,
|
| + value: '',
|
| + },
|
| +
|
| + /** @private {string} */
|
| + printerModel_: {
|
| + type: String,
|
| + value: '',
|
| + },
|
| +
|
| + /** @private {string} */
|
| + printerPPDPath_: {
|
| + type: String,
|
| + value: '',
|
| + },
|
| },
|
|
|
| observers: [
|
| - 'selectedManufacturerChanged_(newPrinter.printerManufacturer)',
|
| + 'selectedManufacturerChanged_(printerManufacturer_)',
|
| + 'selectedModelChanged_(printerModel_)',
|
| ],
|
|
|
| /** @override */
|
| @@ -222,8 +257,15 @@ Polymer({
|
| * @private
|
| */
|
| selectedManufacturerChanged_: function(manufacturer) {
|
| + if (this.inManualFlow) {
|
| + this.set('newPrinter.printerManufacturer', manufacturer);
|
| + this.set('newPrinter.printerModel', '');
|
| + } else {
|
| + this.set('selectedPrinter.printerManufacturer', manufacturer);
|
| + this.set('selectedPrinter.printerModel', '');
|
| + }
|
| // Reset model if manufacturer is changed.
|
| - this.set('newPrinter.printerModel', '');
|
| + this.printerModel_ = '';
|
| if (manufacturer) {
|
| settings.CupsPrintersBrowserProxyImpl.getInstance()
|
| .getCupsPrinterModelsList(manufacturer)
|
| @@ -231,6 +273,14 @@ Polymer({
|
| }
|
| },
|
|
|
| + /** @private */
|
| + selectedModelChanged_: function(model) {
|
| + if (this.inManualFlow)
|
| + this.set('newPrinter.printerModel', model);
|
| + else
|
| + this.set('selectedPrinter.printerModel', model);
|
| + },
|
| +
|
| /** @private */
|
| onBrowseFile_: function() {
|
| settings.CupsPrintersBrowserProxyImpl.getInstance().
|
| @@ -242,7 +292,11 @@ Polymer({
|
| * @private
|
| */
|
| printerPPDPathChanged_: function(path) {
|
| - this.set('newPrinter.printerPPDPath', path);
|
| + this.printerPPDPath_ = path;
|
| + if (this.inManualFlow)
|
| + this.set('newPrinter.printerPPDPath', path);
|
| + else
|
| + this.set('selectedPrinter.printerPPDPath', path);
|
| this.$$('paper-input').value = this.getBaseName_(path);
|
| },
|
|
|
| @@ -349,6 +403,11 @@ Polymer({
|
| value: false,
|
| },
|
|
|
| + inManualFlow: {
|
| + type: Boolean,
|
| + value: false,
|
| + },
|
| +
|
| configuringDialogTitle: String,
|
|
|
| /** @private {string} */
|
| @@ -386,8 +445,7 @@ Polymer({
|
| /** Opens the Add printer discovery dialog. */
|
| open: function() {
|
| this.resetData_();
|
| - this.switchDialog_(
|
| - '', AddPrinterDialogs.MANUALLY, 'showManuallyAddDialog_');
|
| + this.switchDialog_('', AddPrinterDialogs.DISCOVERY, 'showDiscoveryDialog_');
|
| },
|
|
|
| /**
|
| @@ -438,12 +496,12 @@ Polymer({
|
| this.switchDialog_(
|
| this.currentDialog_, AddPrinterDialogs.CONFIGURING,
|
| 'showConfiguringDialog_');
|
| - if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY) {
|
| + if (!this.inManualFlow) {
|
| this.configuringDialogTitle =
|
| loadTimeData.getString('addPrintersNearbyTitle');
|
| settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter(
|
| this.selectedPrinter);
|
| - } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) {
|
| + } else {
|
| this.configuringDialogTitle =
|
| loadTimeData.getString('addPrintersManuallyTitle');
|
| settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter(
|
| @@ -453,18 +511,23 @@ Polymer({
|
|
|
| /** @private */
|
| openManufacturerModelDialog_: function() {
|
| + if (this.currentDialog_ == AddPrinterDialogs.DISCOVERY)
|
| + this.inManualFlow = false;
|
| + else if (this.currentDialog_ == AddPrinterDialogs.MANUALLY)
|
| + this.inManualFlow = true;
|
| +
|
| this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER,
|
| 'showManufacturerDialog_');
|
| },
|
|
|
| /** @private */
|
| configuringDialogClosed_: function() {
|
| - if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) {
|
| + if (this.inManualFlow) {
|
| this.switchDialog_(
|
| this.currentDialog_, this.previousDialog_, 'showManuallyAddDialog_');
|
| - } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) {
|
| + } else {
|
| this.switchDialog_(
|
| - this.currentDialog_, this.previousDialog_, 'showManufacturerDialog_');
|
| + this.currentDialog_, this.previousDialog_, 'showDiscoveryDialog_');
|
| }
|
| },
|
|
|
| @@ -494,13 +557,10 @@ Polymer({
|
| * @private
|
| */
|
| getConfiguringPrinterName_: function() {
|
| - if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY)
|
| - return this.selectedPrinter.printerName;
|
| - if (this.previousDialog_ == AddPrinterDialogs.MANUALLY ||
|
| - this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) {
|
| + if (this.inManualFlow)
|
| return this.newPrinter.printerName;
|
| - }
|
| - return '';
|
| + else
|
| + return this.selectedPrinter.printerName;
|
| },
|
|
|
| /**
|
|
|