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

Side by Side Diff: chrome/browser/resources/print_preview/data/destination.js

Issue 2618313004: [CUPS] Implement the enterprise icon for printers in Print Preview Dialog. (Closed)
Patch Set: Address skau@'s comments. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.exportPath('print_preview'); 5 cr.exportPath('print_preview');
6 6
7 /** 7 /**
8 * The CDD (Cloud Device Description) describes the capabilities of a print 8 * The CDD (Cloud Device Description) describes the capabilities of a print
9 * destination. 9 * destination.
10 * 10 *
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 /** Destination is not provisional. */ 253 /** Destination is not provisional. */
254 NONE: 'NONE', 254 NONE: 'NONE',
255 /** 255 /**
256 * User has to grant USB access for the destination to its provider. 256 * User has to grant USB access for the destination to its provider.
257 * Used for destinations with extension origin. 257 * Used for destinations with extension origin.
258 */ 258 */
259 NEEDS_USB_PERMISSION: 'NEEDS_USB_PERMISSION' 259 NEEDS_USB_PERMISSION: 'NEEDS_USB_PERMISSION'
260 }; 260 };
261 261
262 /** 262 /**
263 * Special tag that denotes whether the destination is an enterprise policy
264 * controlled printer.
265 * @type {string}
266 * @const
267 * @private
268 */
269 Destination.EnterprisePrinterTag_ = '__cp__cups_enterprise_printer=true';
270
271 /**
263 * Enumeration of relative icon URLs for various types of destinations. 272 * Enumeration of relative icon URLs for various types of destinations.
264 * @enum {string} 273 * @enum {string}
265 * @private 274 * @private
266 */ 275 */
267 Destination.IconUrl_ = { 276 Destination.IconUrl_ = {
268 CLOUD: 'images/printer.png', 277 CLOUD: 'images/printer.png',
269 CLOUD_SHARED: 'images/printer_shared.png', 278 CLOUD_SHARED: 'images/printer_shared.png',
270 LOCAL: 'images/printer.png', 279 LOCAL: 'images/printer.png',
271 MOBILE: 'images/mobile.png', 280 MOBILE: 'images/mobile.png',
272 MOBILE_SHARED: 'images/mobile_shared.png', 281 MOBILE_SHARED: 'images/mobile_shared.png',
273 THIRD_PARTY: 'images/third_party.png', 282 THIRD_PARTY: 'images/third_party.png',
274 PDF: 'images/pdf.png', 283 PDF: 'images/pdf.png',
275 DOCS: 'images/google_doc.png', 284 DOCS: 'images/google_doc.png',
276 FEDEX: 'images/third_party_fedex.png' 285 FEDEX: 'images/third_party_fedex.png',
286 ENTERPRISE: 'images/enterprise_printer.png'
277 }; 287 };
278 288
279 Destination.prototype = { 289 Destination.prototype = {
280 /** @return {string} ID of the destination. */ 290 /** @return {string} ID of the destination. */
281 get id() { 291 get id() {
282 return this.id_; 292 return this.id_;
283 }, 293 },
284 294
285 /** @return {!print_preview.Destination.Type} Type of the destination. */ 295 /** @return {!print_preview.Destination.Type} Type of the destination. */
286 get type() { 296 get type() {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 get iconUrl() { 490 get iconUrl() {
481 if (this.id_ == Destination.GooglePromotedId.DOCS) { 491 if (this.id_ == Destination.GooglePromotedId.DOCS) {
482 return Destination.IconUrl_.DOCS; 492 return Destination.IconUrl_.DOCS;
483 } 493 }
484 if (this.id_ == Destination.GooglePromotedId.FEDEX) { 494 if (this.id_ == Destination.GooglePromotedId.FEDEX) {
485 return Destination.IconUrl_.FEDEX; 495 return Destination.IconUrl_.FEDEX;
486 } 496 }
487 if (this.id_ == Destination.GooglePromotedId.SAVE_AS_PDF) { 497 if (this.id_ == Destination.GooglePromotedId.SAVE_AS_PDF) {
488 return Destination.IconUrl_.PDF; 498 return Destination.IconUrl_.PDF;
489 } 499 }
500 if (this.isEnterprisePrinter) {
501 return Destination.IconUrl_.ENTERPRISE;
502 }
490 if (this.isLocal) { 503 if (this.isLocal) {
491 return Destination.IconUrl_.LOCAL; 504 return Destination.IconUrl_.LOCAL;
492 } 505 }
493 if (this.type_ == Destination.Type.MOBILE && this.isOwned_) { 506 if (this.type_ == Destination.Type.MOBILE && this.isOwned_) {
494 return Destination.IconUrl_.MOBILE; 507 return Destination.IconUrl_.MOBILE;
495 } 508 }
496 if (this.type_ == Destination.Type.MOBILE) { 509 if (this.type_ == Destination.Type.MOBILE) {
497 return Destination.IconUrl_.MOBILE_SHARED; 510 return Destination.IconUrl_.MOBILE_SHARED;
498 } 511 }
499 if (this.isOwned_) { 512 if (this.isOwned_) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 get provisionalType() { 562 get provisionalType() {
550 return this.provisionalType_; 563 return this.provisionalType_;
551 }, 564 },
552 565
553 /** 566 /**
554 * Whether the destinaion is provisional. 567 * Whether the destinaion is provisional.
555 * @return {boolean} 568 * @return {boolean}
556 */ 569 */
557 get isProvisional() { 570 get isProvisional() {
558 return this.provisionalType_ != Destination.ProvisionalType.NONE; 571 return this.provisionalType_ != Destination.ProvisionalType.NONE;
559 } 572 },
573
574 /**
575 * Whether the printer is enterprise policy controlled printer.
576 * @return {boolean}
577 */
578 get isEnterprisePrinter() {
579 return arrayContains(this.tags_, Destination.EnterprisePrinterTag_);
580 },
560 }; 581 };
561 582
562 // Export 583 // Export
563 return { 584 return {
564 Destination: Destination, 585 Destination: Destination,
565 }; 586 };
566 }); 587 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698