Chromium Code Reviews| 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 d2270f7c1a2fe01b487d5cc35d01b936cc3ae8d7..c18106bb69e79391009ea1cd0d06d2ee87920f0c 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'); |
| }, |
| }); |
| @@ -189,6 +189,12 @@ Polymer({ |
| notify: true, |
| }, |
| + /** @type {!CupsPrinterInfo} */ |
| + selectedPrinter: { |
| + type: Object, |
| + notify: true, |
| + }, |
| + |
| /** @type {?Array<string>} */ |
| manufacturerList: { |
| type: Array, |
| @@ -336,6 +342,16 @@ Polymer({ |
| value: false, |
| }, |
| + /** |
| + * @type {boolean} whether we're doing manufacturer/model in |
| + * a manual flow (as opposed to a discovery flow). |
| + * @private |
| + */ |
| + inManualFlow: { |
| + type: Boolean, |
| + value: false, |
| + }, |
| + |
| configuringDialogTitle: String, |
| /** @private {string} */ |
| @@ -373,8 +389,7 @@ Polymer({ |
| /** Opens the Add printer discovery dialog. */ |
| open: function() { |
| this.resetData_(); |
| - this.switchDialog_( |
| - '', AddPrinterDialogs.MANUALLY, 'showManuallyAddDialog_'); |
| + this.switchDialog_('', AddPrinterDialogs.DISCOVERY, 'showDiscoveryDialog_'); |
| }, |
| /** |
| @@ -442,6 +457,20 @@ Polymer({ |
| openManufacturerModelDialog_: function() { |
| this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER, |
| 'showManufacturerDialog_'); |
| + this.inManualFlow = false; |
| + if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) { |
| + this.inManualFlow = true; |
| + } else if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY) { |
| + // If we come to the manufacturer-model dialog via discovery, then the new |
| + // printer we're working with is the selected one, so copy it over. If we |
| + // have a manufacturer entry from detection we'll leave it intact, but |
| + // clear any manufacturer/model entries since the fact that we need to |
| + // have the user select means we don't think we have the right one. |
| + this.newPrinter = Object.assign({}, this.selectedPrinter); |
|
xdai1
2017/05/10 20:12:53
The reason I prefer not "copying fields over" eith
Carlson
2017/05/10 21:28:18
I think I understand this now. Replied at top lev
|
| + this.newPrinter.printerManufacturer = ''; |
| + this.newPrinter.printerModel = ''; |
| + this.newPrinter.printerPPDPath = ''; |
| + } |
| }, |
| /** @private */ |