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 8e1d7de443205c16582434c5e374fa71b1a13b89..c44241e185dc4e65fc155c668228408f7956ea58 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 |
| @@ -49,6 +49,7 @@ function getEmptyPrinter_() { |
| printerProtocol: 'ipp', |
| printerQueue: '', |
| printerStatus: '', |
| + autoconf: false, |
|
Carlson
2017/05/31 16:58:52
Dunno why the printerXXX naming convention is used
skau
2017/06/01 21:50:28
No reason either way AFAICT. I've changed it.
|
| }; |
| } |
| @@ -168,6 +169,46 @@ Polymer({ |
| this.$$('add-printer-dialog').close(); |
| }, |
| + /** |
| + * @param {!PrinterMakeModel} info |
| + * @private |
| + * */ |
| + onPrinterFound_: function(info) { |
| + this.newPrinter.printerManufacturer = info[0]; |
| + this.newPrinter.printerModel = info[1]; |
| + this.newPrinter.autoconf = info[2]; |
| + |
| + if (!this.newPrinter.autoconf) { |
| + this.switchToManufacturerDialog_(); |
| + return; |
|
Carlson
2017/05/31 16:58:52
nit:
if () {
x
} else {
y
}
seems slightly
skau
2017/06/01 21:50:28
Done.
|
| + } |
| + |
| + // Open configuring dialog. |
|
Carlson
2017/05/31 16:58:52
Generally, better to comment why you're doing stuf
skau
2017/06/01 21:50:28
Done.
|
| + this.$$('add-printer-dialog').close(); |
| + this.fire('open-configuring-printer-dialog'); |
| + }, |
| + |
| + /** |
| + * @param {!QueryFailure} rejected |
| + * @private |
| + */ |
| + infoFailed_: function(rejected) { |
|
Carlson
2017/05/31 16:58:52
Why is rejected not used?
skau
2017/06/01 21:50:29
There's nothing useful in it at the moment. But t
|
| + this.switchToManufacturerDialog_(); |
| + }, |
| + |
| + /** @private */ |
| + addPressed_: function() { |
| + if (this.newPrinter.printerProtocol == 'ipp' || |
| + this.newPrinter.printerProtocol == 'ipps') { |
| + settings.CupsPrintersBrowserProxyImpl.getInstance(). |
| + getPrinterInfo(this.newPrinter). |
| + then(this.onPrinterFound_.bind(this), this.infoFailed_.bind(this)); |
| + return; |
| + } |
| + |
| + this.switchToManufacturerDialog_(); |
| + }, |
| + |
| /** @private */ |
| switchToManufacturerDialog_: function() { |
| // Set the default printer queue to be "ipp/print". |
| @@ -425,7 +466,9 @@ Polymer({ |
| loadTimeData.getString('addPrintersNearbyTitle'); |
| settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter( |
| this.newPrinter); |
| - } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { |
| + } else if ( |
| + this.previousDialog_ == AddPrinterDialogs.MANUFACTURER || |
| + this.previousDialog_ == AddPrinterDialogs.MANUALLY) { |
| this.configuringDialogTitle = |
| loadTimeData.getString('addPrintersManuallyTitle'); |
| settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter( |