| 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 d97e93bd526bea01795afe316b1875f942fcf82c..f85be0d9e7132bdda5aca143d4c8a142db457054 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
|
| @@ -45,7 +45,7 @@ Polymer({
|
| },
|
|
|
| /** @type {!CupsPrinterInfo} */
|
| - selectedPrinter: {
|
| + newPrinter: {
|
| type: Object,
|
| notify: true,
|
| },
|
| @@ -73,12 +73,11 @@ Polymer({
|
| * @private
|
| */
|
| onPrinterDiscovered_: function(printers) {
|
| - this.discovering_ = true;
|
| - if (!this.discoveredPrinters) {
|
| - this.discoveredPrinters = printers;
|
| - } else {
|
| - for (var i = 0; i < printers.length; i++)
|
| - this.push('discoveredPrinters', printers[i]);
|
| + this.discoveredPrinters = printers;
|
| + if (!this.discovering_) {
|
| + // This update happened after we already finished the initial
|
| + // scan, so re-run the discovery done logic.
|
| + this.onPrinterDiscoveryDone_();
|
| }
|
| },
|
|
|
| @@ -115,6 +114,13 @@ Polymer({
|
| this.$$('add-printer-dialog').close();
|
| this.fire('open-configuring-printer-dialog');
|
| },
|
| +
|
| + /** @private */
|
| + switchToManufacturerDialog_: function() {
|
| + this.stopDiscoveringPrinters_();
|
| + this.$$('add-printer-dialog').close();
|
| + this.fire('open-manufacturer-model-dialog');
|
| + },
|
| });
|
|
|
| Polymer({
|
| @@ -317,11 +323,6 @@ Polymer({
|
|
|
| properties: {
|
| /** @type {!CupsPrinterInfo} */
|
| - selectedPrinter: {
|
| - type: Object,
|
| - },
|
| -
|
| - /** @type {!CupsPrinterInfo} */
|
| newPrinter: {
|
| type: Object,
|
| },
|
| @@ -369,8 +370,7 @@ Polymer({
|
| /** Opens the Add printer discovery dialog. */
|
| open: function() {
|
| this.resetData_();
|
| - this.switchDialog_(
|
| - '', AddPrinterDialogs.MANUALLY, 'showManuallyAddDialog_');
|
| + this.switchDialog_('', AddPrinterDialogs.DISCOVERY, 'showDiscoveryDialog_');
|
| },
|
|
|
| /**
|
| @@ -378,8 +378,6 @@ Polymer({
|
| * @private
|
| */
|
| resetData_: function() {
|
| - if (this.selectedPrinter)
|
| - this.selectedPrinter = this.getEmptyPrinter_();
|
| if (this.newPrinter)
|
| this.newPrinter = this.getEmptyPrinter_();
|
| this.setupFailed = false;
|
| @@ -424,14 +422,12 @@ Polymer({
|
| if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY) {
|
| this.configuringDialogTitle =
|
| loadTimeData.getString('addPrintersNearbyTitle');
|
| - settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter(
|
| - this.selectedPrinter);
|
| } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) {
|
| this.configuringDialogTitle =
|
| loadTimeData.getString('addPrintersManuallyTitle');
|
| - settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter(
|
| - this.newPrinter);
|
| }
|
| + settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter(
|
| + this.newPrinter);
|
| },
|
|
|
| /** @private */
|
| @@ -477,9 +473,8 @@ Polymer({
|
| * @private
|
| */
|
| getConfiguringPrinterName_: function() {
|
| - if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY)
|
| - return this.selectedPrinter.printerName;
|
| - if (this.previousDialog_ == AddPrinterDialogs.MANUALLY ||
|
| + if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY ||
|
| + this.previousDialog_ == AddPrinterDialogs.MANUALLY ||
|
| this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) {
|
| return this.newPrinter.printerName;
|
| }
|
|
|