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

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

Issue 2332483002: [CUPS] Implement the CUPS printer PPD file picker in the manufacturer and model dialog. (Closed)
Patch Set: Fix the failed closure_compilation trybot. Created 4 years, 3 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
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 b8dc24498eb27f9aa1ed0bdceab67cbd6de089fa..9a448f2379bfcb989c5db3d5adb5b3c34b6a6196 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
@@ -75,15 +75,16 @@ Polymer({
notify: true,
value: function() {
return {
- printerAddress: '',
- printerDescription: '',
- printerId: '',
- printerManufacturer: '',
- printerModel: '',
- printerName: '',
- printerProtocol: 'ipp',
- printerQueue: '',
- printerStatus: '',
+ printerAddress: '',
+ printerDescription: '',
+ printerId: '',
+ printerManufacturer: '',
+ printerModel: '',
+ printerName: '',
+ printerPPDPath: '',
+ printerProtocol: 'ipp',
+ printerQueue: '',
+ printerStatus: '',
};
},
},
@@ -187,6 +188,21 @@ Polymer({
},
/** @private */
+ onBrowseFile_: function() {
+ settings.CupsPrintersBrowserProxyImpl.getInstance().
+ getCupsPrinterPPDPath().then(this.printerPPDPathChanged_.bind(this));
+ },
+
+ /**
+ * @param {string} path
+ * @private
+ */
+ printerPPDPathChanged_: function(path) {
+ this.newPrinter.printerPPDPath = path;
+ this.$$('paper-input').value = this.getBaseName_(path);
+ },
+
+ /** @private */
switchToManualAddDialog_: function() {
this.$$('add-printer-dialog').close();
this.fire('open-manually-add-printer-dialog');
@@ -202,6 +218,15 @@ Polymer({
this.$$('add-printer-dialog').close();
this.fire('open-configuring-printer-dialog');
},
+
+ /**
+ * @param {string} path The full path of the file
+ * @return {string} The base name of the file
+ * @private
+ */
+ getBaseName_: function(path) {
+ return path.substring(path.lastIndexOf('/') + 1);
+ },
});
Polymer({

Powered by Google App Engine
This is Rietveld 408576698