Commit 1e4a01c7 authored by Gavin Williams's avatar Gavin Williams Committed by Chromium LUCI CQ

Add an enterprise printer status icon for Print Preview

Show the new status icons for local CrOS enterprise destinations in
the dropdown and in the destination dialog.

http://screen/Ar4TwJzsnGBmQeo
http://screen/49UeCL7e9KMmuUy

Bug: 1146550
Change-Id: Iaa5c2933db43f32fe054619863b71c7483af62b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2572396Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Gavin Williams <gavinwill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833750}
parent 57449775
...@@ -134,16 +134,22 @@ export function computePrinterState(printerStatusReason) { ...@@ -134,16 +134,22 @@ export function computePrinterState(printerStatusReason) {
/** /**
* @param {?PrinterStatusReason} printerStatusReason * @param {?PrinterStatusReason} printerStatusReason
* @param {boolean} isEnterprisePrinter
* @return {string} * @return {string}
*/ */
export function getPrinterStatusIcon(printerStatusReason) { export function getPrinterStatusIcon(printerStatusReason, isEnterprisePrinter) {
switch (computePrinterState(printerStatusReason)) { switch (computePrinterState(printerStatusReason)) {
case PrinterState.GOOD: case PrinterState.GOOD:
return 'print-preview:printer-status-green'; return isEnterprisePrinter ?
'print-preview:business-printer-status-green' :
'print-preview:printer-status-green';
case PrinterState.ERROR: case PrinterState.ERROR:
return 'print-preview:printer-status-red'; return isEnterprisePrinter ? 'print-preview:business-printer-status-red' :
'print-preview:printer-status-red';
case PrinterState.UNKNOWN: case PrinterState.UNKNOWN:
return 'print-preview:printer-status-grey'; return isEnterprisePrinter ?
'print-preview:business-printer-status-grey' :
'print-preview:printer-status-grey';
default: default:
assertNotReached(); assertNotReached();
} }
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
aria-description$="[[getPrinterStatusErrorString_( aria-description$="[[getPrinterStatusErrorString_(
item.printerStatusReason)]]"> item.printerStatusReason)]]">
<iron-icon icon="[[getPrinterStatusIcon_( <iron-icon icon="[[getPrinterStatusIcon_(
item.printerStatusReason)]]"> item.printerStatusReason, item.isEnterprisePrinter)]]">
</iron-icon> </iron-icon>
<span class="printer-display-name">[[item.displayName]]</span> <span class="printer-display-name">[[item.displayName]]</span>
</button> </button>
......
...@@ -327,10 +327,11 @@ Polymer({ ...@@ -327,10 +327,11 @@ Polymer({
/** /**
* @param {!PrinterStatusReason} printerStatusReason * @param {!PrinterStatusReason} printerStatusReason
* @param {boolean} isEnterprisePrinter
* @return {string} * @return {string}
* @private * @private
*/ */
getPrinterStatusIcon_(printerStatusReason) { getPrinterStatusIcon_(printerStatusReason, isEnterprisePrinter) {
return getPrinterStatusIcon(printerStatusReason); return getPrinterStatusIcon(printerStatusReason, isEnterprisePrinter);
} }
}); });
...@@ -246,7 +246,9 @@ Polymer({ ...@@ -246,7 +246,9 @@ Polymer({
// <if expr="chromeos"> // <if expr="chromeos">
if (this.printerStatusFlagEnabled_ && if (this.printerStatusFlagEnabled_ &&
this.destination.origin === DestinationOrigin.CROS) { this.destination.origin === DestinationOrigin.CROS) {
return getPrinterStatusIcon(this.destination.printerStatusReason); return getPrinterStatusIcon(
this.destination.printerStatusReason,
this.destination.isEnterprisePrinter);
} }
// </if> // </if>
......
...@@ -146,7 +146,9 @@ Polymer({ ...@@ -146,7 +146,9 @@ Polymer({
if (this.destination && this.destination.key === this.selectedValue) { if (this.destination && this.destination.key === this.selectedValue) {
if (this.printerStatusFlagEnabled_ && if (this.printerStatusFlagEnabled_ &&
this.isCurrentDestinationCrosLocal_) { this.isCurrentDestinationCrosLocal_) {
return getPrinterStatusIcon(this.destination.printerStatusReason); return getPrinterStatusIcon(
this.destination.printerStatusReason,
this.destination.isEnterprisePrinter);
} }
return this.destination.icon; return this.destination.icon;
......
...@@ -34,6 +34,18 @@ ...@@ -34,6 +34,18 @@
<path d="M19,8 C20.66,8 22,9.34 22,11 L22,11 L22.0008411,12.1834702 C20.9260374,10.5660653 19.0875152,9.5 17,9.5 C14.2041481,9.5 11.8549346,11.412286 11.1889599,14.0002575 L8,14 L8,19 L12.1267078,19.0009178 C12.7530956,19.8713157 13.6069102,20.5670952 14.6011413,21.0012461 L6,21 L6,17 L2,17 L2,11 C2,9.34 3.34,8 5,8 L5,8 Z M18,3 L18,7 L6,7 L6,3 L18,3 Z"></path> <path d="M19,8 C20.66,8 22,9.34 22,11 L22,11 L22.0008411,12.1834702 C20.9260374,10.5660653 19.0875152,9.5 17,9.5 C14.2041481,9.5 11.8549346,11.412286 11.1889599,14.0002575 L8,14 L8,19 L12.1267078,19.0009178 C12.7530956,19.8713157 13.6069102,20.5670952 14.6011413,21.0012461 L6,21 L6,17 L2,17 L2,11 C2,9.34 3.34,8 5,8 L5,8 Z M18,3 L18,7 L6,7 L6,3 L18,3 Z"></path>
<circle fill="#d93025" cx="17" cy="15.5" r="3.5"></circle> <circle fill="#d93025" cx="17" cy="15.5" r="3.5"></circle>
</g> </g>
<g id="business-printer-status-green">
<path d="M12,3 L12,7 L22,7 L22.0008411,12.1834702 C21.4889261,11.4131214 20.8037622,10.7678435 20.000963,10.3032504 L20,9 L12,9 L12,11 L13.0312427,11.0000183 C11.7856236,12.0994345 11,13.7079712 11,15.5 C11,16.7266262 11.3680857,17.8672813 11.9998276,18.8175358 L12,19 L12.1267078,19.0009178 C12.7530956,19.8713157 13.6069102,20.5670952 14.6011413,21.0012461 L2,21 L2,3 L12,3 Z M6,17 L4,17 L4,19 L6,19 L6,17 Z M10,17 L8,17 L8,19 L10,19 L10,17 Z M6,13 L4,13 L4,15 L6,15 L6,13 Z M10,13 L8,13 L8,15 L10,15 L10,13 Z M6,9 L4,9 L4,11 L6,11 L6,9 Z M10,9 L8,9 L8,11 L10,11 L10,9 Z M6,5 L4,5 L4,7 L6,7 L6,5 Z M10,5 L8,5 L8,7 L10,7 L10,5 Z"></path>
<circle fill="#188038" cx="17" cy="15.5" r="3.5"></circle>
</g>
<g id="business-printer-status-grey">
<path d="M12,3 L12,7 L22,7 L22.0008411,12.1834702 C21.4889261,11.4131214 20.8037622,10.7678435 20.000963,10.3032504 L20,9 L12,9 L12,11 L13.0312427,11.0000183 C11.7856236,12.0994345 11,13.7079712 11,15.5 C11,16.7266262 11.3680857,17.8672813 11.9998276,18.8175358 L12,19 L12.1267078,19.0009178 C12.7530956,19.8713157 13.6069102,20.5670952 14.6011413,21.0012461 L2,21 L2,3 L12,3 Z M6,17 L4,17 L4,19 L6,19 L6,17 Z M10,17 L8,17 L8,19 L10,19 L10,17 Z M6,13 L4,13 L4,15 L6,15 L6,13 Z M10,13 L8,13 L8,15 L10,15 L10,13 Z M6,9 L4,9 L4,11 L6,11 L6,9 Z M10,9 L8,9 L8,11 L10,11 L10,9 Z M6,5 L4,5 L4,7 L6,7 L6,5 Z M10,5 L8,5 L8,7 L10,7 L10,5 Z"></path>
<circle fill="#9aa0a6" cx="17" cy="15.5" r="3.5"></circle>
</g>
<g id="business-printer-status-red">
<path d="M12,3 L12,7 L22,7 L22.0008411,12.1834702 C21.4889261,11.4131214 20.8037622,10.7678435 20.000963,10.3032504 L20,9 L12,9 L12,11 L13.0312427,11.0000183 C11.7856236,12.0994345 11,13.7079712 11,15.5 C11,16.7266262 11.3680857,17.8672813 11.9998276,18.8175358 L12,19 L12.1267078,19.0009178 C12.7530956,19.8713157 13.6069102,20.5670952 14.6011413,21.0012461 L2,21 L2,3 L12,3 Z M6,17 L4,17 L4,19 L6,19 L6,17 Z M10,17 L8,17 L8,19 L10,19 L10,17 Z M6,13 L4,13 L4,15 L6,15 L6,13 Z M10,13 L8,13 L8,15 L10,15 L10,13 Z M6,9 L4,9 L4,11 L6,11 L6,9 Z M10,9 L8,9 L8,11 L10,11 L10,9 Z M6,5 L4,5 L4,7 L6,7 L6,5 Z M10,5 L8,5 L8,7 L10,7 L10,5 Z"></path>
<circle fill="#d93025" cx="17" cy="15.5" r="3.5"></circle>
</g>
</if> </if>
<!-- <!--
......
...@@ -359,7 +359,8 @@ suite(printer_status_test_cros.suiteName, function() { ...@@ -359,7 +359,8 @@ suite(printer_status_test_cros.suiteName, function() {
destinationSelect.destination = crosEnterprisePrinter; destinationSelect.destination = crosEnterprisePrinter;
destinationSelect.updateDestination(); destinationSelect.updateDestination();
assertEquals( assertEquals(
'print-preview:printer-status-grey', dropdown.destinationIcon); 'print-preview:business-printer-status-grey',
dropdown.destinationIcon);
destinationSelect.destination = mobilePrinter; destinationSelect.destination = mobilePrinter;
destinationSelect.updateDestination(); destinationSelect.updateDestination();
......
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