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 4bbaeb12f2853cb6a7a66c2dde5545f02ed5c338..4d0f2ed9844370f13238a9ddd4f000aba185d6c4 100644 |
| --- a/chrome/browser/resources/print_preview/data/destination.js |
| +++ b/chrome/browser/resources/print_preview/data/destination.js |
| @@ -54,6 +54,7 @@ cr.define('print_preview', function() { |
| * lastAccessTime: (number|undefined), |
| * isTosAccepted: (boolean|undefined), |
| * cloudID: (string|undefined), |
| + * extensionId: (string|undefined), |
| * description: (string|undefined)}=} opt_params Optional parameters |
| * for the destination. |
| * @constructor |
| @@ -153,6 +154,12 @@ cr.define('print_preview', function() { |
| * @private {string} |
| */ |
| this.cloudID_ = (opt_params && opt_params.cloudID) || ''; |
| + |
| + /** |
| + * Extension ID for extension managed printers. |
| + * @private {string} |
| + */ |
| + this.extensionId_ = (opt_params && opt_params.extensionId) || ''; |
| }; |
| /** |
| @@ -195,7 +202,8 @@ cr.define('print_preview', function() { |
| COOKIES: 'cookies', |
| PROFILE: 'profile', |
| DEVICE: 'device', |
| - PRIVET: 'privet' |
| + PRIVET: 'privet', |
| + EXTENSION: 'extension' |
| }; |
| /** |
| @@ -280,6 +288,7 @@ cr.define('print_preview', function() { |
| /** @return {boolean} Whether the destination is local or cloud-based. */ |
| get isLocal() { |
| return this.origin_ == Destination.Origin.LOCAL || |
| + this.origin_ == Destination.Origin.EXTENSION || |
| (this.origin_ == Destination.Origin.PRIVET && |
| this.connectionStatus_ != |
| Destination.ConnectionStatus.UNREGISTERED); |
| @@ -291,6 +300,14 @@ cr.define('print_preview', function() { |
| }, |
| /** |
| + * @return {boolean} Whether the destination is an extension managed |
| + * printer. |
| + */ |
| + get isExtension() { |
| + return this.origin_ == Destination.Origin.EXTENSION; |
| + }, |
| + |
| + /** |
| * @return {string} The location of the destination, or an empty string if |
| * the location is unknown. |
| */ |
| @@ -339,6 +356,14 @@ cr.define('print_preview', function() { |
| return this.cloudID_; |
| }, |
| + /** |
| + * @return {string} Extension ID associated with the destination. Set only |
| + * for extension managed printers. |
|
Aleksey Shlyapnikov
2015/02/04 18:50:27
Nit: It is always set, it's just set to '' for non
tbarzic
2015/02/04 19:27:41
Done.
|
| + */ |
| + get extensionId() { |
| + return this.extensionId_; |
| + }, |
| + |
| /** @return {?print_preview.Cdd} Print capabilities of the destination. */ |
| get capabilities() { |
| return this.capabilities_; |
| @@ -410,6 +435,10 @@ cr.define('print_preview', function() { |
| return Destination.IconUrl_.FEDEX; |
| } else if (this.id_ == Destination.GooglePromotedId.SAVE_AS_PDF) { |
| return Destination.IconUrl_.PDF; |
| + } else if (this.isExtension) { |
| + // TODO(tbarzic): Update the way extension printers are displayed in the |
| + // destination list when the desired UX is defined. |
| + return 'chrome://extension-icon/' + this.extensionId + '/48/1'; |
| } else if (this.isLocal) { |
| return Destination.IconUrl_.LOCAL; |
| } else if (this.type_ == Destination.Type.MOBILE && this.isOwned_) { |