Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2339)

Unified Diff: chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js

Issue 2979903003: [CUPS] If no printers is auto-discovered, show the manual printer setup dialog (Closed)
Patch Set: . Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0fee051cf95d01558a8fc13a7ede461664bfefbe..aea91eb0e4261c88cd6c248284696f6f0856a883 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
@@ -84,8 +84,10 @@ Polymer({
'on-printer-discovered', this.onPrinterDiscovered_.bind(this));
this.addWebUIListener(
'on-printer-discovery-done', this.onPrinterDiscoveryDone_.bind(this));
- this.addWebUIListener(
- 'on-printer-discovery-failed', this.onPrinterDiscoveryDone_.bind(this));
+ },
+
+ close: function() {
+ this.$$('add-printer-dialog').close();
},
/**
@@ -106,7 +108,10 @@ Polymer({
onPrinterDiscoveryDone_: function() {
this.discovering_ = false;
this.$$('add-printer-list').style.maxHeight = kPrinterListFullHeight + 'px';
- this.$.noPrinterMessage.hidden = !!this.discoveredPrinters;
+ this.$.noPrinterMessage.hidden = !!this.discoveredPrinters.length;
+
+ if (!this.discoveredPrinters.length)
+ this.fire('no-detected-printer');
},
/** @private */
@@ -378,6 +383,7 @@ Polymer({
'open-configuring-printer-dialog': 'openConfiguringPrinterDialog_',
'open-discovery-printers-dialog': 'openDiscoveryPrintersDialog_',
'open-manufacturer-model-dialog': 'openManufacturerModelDialog_',
+ 'no-detected-printer': 'onNoDetectedPrinter_',
},
/** @override */
@@ -510,6 +516,17 @@ Polymer({
}
},
+ /** @private */
+ onNoDetectedPrinter_: function() {
+ // If there is no detected printer, automatically open manually-add-printer
+ // dialog only when the user opens the discovery-dialog through the
+ // "ADD PRINTER" button.
+ if (!this.previousDialog_) {
+ this.$$('add-printer-discovery-dialog').close();
+ this.openManuallyAddPrinterDialog_();
+ }
+ },
+
/**
* Switch dialog from |fromDialog| to |toDialog|.
* @param {string} fromDialog
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698