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({ |