Commit 7f1d7dbb authored by David Valleau's avatar David Valleau Committed by Commit Bot

Adding error message for when a user selects an invalid PPD file

This change is built off of https://crrev.com/c/887858 which added basic
verification to user-selected PPD files in order to provide them with
more immediate feedback when they select an invalid file. This change is
simply adding an error message that is displayed to the user.

Here are some screenshots of what this change looks like in the UI:

  - invalid PPD (https://screenshot.googleplex.com/YKH4CPFTJpV.png)
  - valid PPD (https://screenshot.googleplex.com/ube7K8v9QtT.png)

R=dpapad@chromium.org, xdai@chromium.org

Bug: 778462,806915
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I6992a594cbf0c086e136c32814b8070724b1ed71
Reviewed-on: https://chromium-review.googlesource.com/898432Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: David Valleau <valleau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537151}
parent 3fdfbfaa
...@@ -1180,6 +1180,9 @@ ...@@ -1180,6 +1180,9 @@
<message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_BUTTON_SELECT_DRIVER" desc="Text for the button which allows user to select a PPD file from the file system."> <message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_BUTTON_SELECT_DRIVER" desc="Text for the button which allows user to select a PPD file from the file system.">
Browse Browse
</message> </message>
<message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_INVALID_DRIVER" desc="Error message displayed to the user if they select an invalid PPD file.">
Invalid file selected. Try again.
</message>
<message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_ADDED_PRINTER_DONE_MESSAGE" desc="The message shown when a new printer is set up successfully."> <message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_ADDED_PRINTER_DONE_MESSAGE" desc="The message shown when a new printer is set up successfully.">
Added <ph name="PRINTER_NAME">$1<ex>printer</ex></ph> Added <ph name="PRINTER_NAME">$1<ex>printer</ex></ph>
</message> </message>
......
...@@ -233,7 +233,9 @@ ...@@ -233,7 +233,9 @@
<div class="label">$i18n{selectDriver}</div> <div class="label">$i18n{selectDriver}</div>
<div class="secondary"> <div class="secondary">
<paper-input class="browse-file-input" no-label-float readonly <paper-input class="browse-file-input" no-label-float readonly
value="[[getBaseName_(activePrinter.printerPPDPath)]]"> value="[[getBaseName_(activePrinter.printerPPDPath)]]"
error-message="$i18n{selectDriverErrorMessage}"
invalid="[[invalidPPD]]">
<paper-button class="browse-button" suffix <paper-button class="browse-button" suffix
on-tap="onBrowseFile_"> on-tap="onBrowseFile_">
$i18n{selectDriverButtonText} $i18n{selectDriverButtonText}
......
...@@ -16,15 +16,16 @@ const SetManufacturerModelBehavior = { ...@@ -16,15 +16,16 @@ const SetManufacturerModelBehavior = {
notify: true, notify: true,
}, },
/** @type {?Array<string>} */ invalidPPD: {
manufacturerList: { type: Boolean,
type: Array, value: false,
}, },
/** @type {?Array<string>} */ /** @type {?Array<string>} */
modelList: { manufacturerList: Array,
type: Array,
}, /** @type {?Array<string>} */
modelList: Array,
}, },
observers: [ observers: [
...@@ -90,9 +91,8 @@ const SetManufacturerModelBehavior = { ...@@ -90,9 +91,8 @@ const SetManufacturerModelBehavior = {
* @private * @private
*/ */
printerPPDPathChanged_: function(path) { printerPPDPathChanged_: function(path) {
// TODO(valleau): Display an error message to users
// (https://crbug.com/806915)
this.set('activePrinter.printerPPDPath', path); this.set('activePrinter.printerPPDPath', path);
this.invalidPPD = !path;
}, },
/** /**
......
...@@ -1648,6 +1648,8 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) { ...@@ -1648,6 +1648,8 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
{"selectDriver", IDS_SETTINGS_PRINTING_CUPS_PRINTER_SELECT_DRIVER}, {"selectDriver", IDS_SETTINGS_PRINTING_CUPS_PRINTER_SELECT_DRIVER},
{"selectDriverButtonText", {"selectDriverButtonText",
IDS_SETTINGS_PRINTING_CUPS_PRINTER_BUTTON_SELECT_DRIVER}, IDS_SETTINGS_PRINTING_CUPS_PRINTER_BUTTON_SELECT_DRIVER},
{"selectDriverErrorMessage",
IDS_SETTINGS_PRINTING_CUPS_PRINTER_INVALID_DRIVER},
{"printerAddedSuccessfulMessage", {"printerAddedSuccessfulMessage",
IDS_SETTINGS_PRINTING_CUPS_PRINTER_ADDED_PRINTER_DONE_MESSAGE}, IDS_SETTINGS_PRINTING_CUPS_PRINTER_ADDED_PRINTER_DONE_MESSAGE},
{"noPrinterNearbyMessage", {"noPrinterNearbyMessage",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment