Chromium Code Reviews| Index: chrome/browser/resources/print_preview/data/destination.js |
| diff --git a/chrome/browser/resources/print_preview/data/destination.js b/chrome/browser/resources/print_preview/data/destination.js |
| index c4ae78e4db36e9b98176fb370d8bdff28a489f99..d5db22331b81e341799dbe9936bb80738c3bf580 100644 |
| --- a/chrome/browser/resources/print_preview/data/destination.js |
| +++ b/chrome/browser/resources/print_preview/data/destination.js |
| @@ -261,6 +261,15 @@ cr.define('print_preview', function() { |
| }; |
| /** |
| + * Special tag that denotes whether the destination is an enterprise policy |
| + * controlled printer. |
| + * @type {string} |
| + * @const |
| + * @private |
| + */ |
| + Destination.EnterprisePrinterTag_ = '__cp__cups_enterprise_printer=true'; |
| + |
| + /** |
| * Enumeration of relative icon URLs for various types of destinations. |
| * @enum {string} |
| * @private |
| @@ -274,7 +283,8 @@ cr.define('print_preview', function() { |
| THIRD_PARTY: 'images/third_party.png', |
| PDF: 'images/pdf.png', |
| DOCS: 'images/google_doc.png', |
| - FEDEX: 'images/third_party_fedex.png' |
| + FEDEX: 'images/third_party_fedex.png', |
| + ENTERPRISE: 'images/business.svg' |
| }; |
| Destination.prototype = { |
| @@ -489,6 +499,9 @@ cr.define('print_preview', function() { |
| if (this.id_ == Destination.GooglePromotedId.SAVE_AS_PDF) { |
| return Destination.IconUrl_.PDF; |
| } |
| + if (this.isEnterprisePrinter) { |
| + return Destination.IconUrl_.ENTERPRISE; |
| + } |
| if (this.isLocal) { |
| return Destination.IconUrl_.LOCAL; |
| } |
| @@ -558,7 +571,15 @@ cr.define('print_preview', function() { |
| */ |
| get isProvisional() { |
| return this.provisionalType_ != Destination.ProvisionalType.NONE; |
| - } |
| + }, |
| + |
| + /** |
| + * Whether the printer is enterprise policy controlled printer. |
| + * @return {boolean} |
| + */ |
| + get isEnterprisePrinter() { |
| + return arrayContains(this.tags_, Destination.EnterprisePrinterTag_); |
|
dpapad
2017/01/18 02:56:04
Is this linear search going to be costly? What is
xdai1
2017/01/18 18:45:42
For a single printer, the size of |tags_| equals t
skau
2017/01/18 20:59:06
FYI: We expect around 20 printer properties for an
dpapad
2017/01/18 21:09:57
So if I have hundreds of printers (like in a Googl
skau
2017/01/18 22:05:40
xdai@ We should probably make isEnterprise a separ
xdai1
2017/01/19 01:10:17
I made isEnterprise_ a separate field on the desti
xdai1
2017/01/19 01:10:17
the format of|this.tags_| (https://cs.chromium.org
|
| + }, |
| }; |
| // Export |