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 01a9491069556b724effcaefc591b07c69dd429f..b0956136780558e1e39fe55bad8fed5204fb9a23 100644 |
| --- a/chrome/browser/resources/print_preview/data/destination.js |
| +++ b/chrome/browser/resources/print_preview/data/destination.js |
| @@ -9,13 +9,15 @@ cr.define('print_preview', function() { |
| * Print destination data object that holds data for both local and cloud |
| * destinations. |
| * @param {string} id ID of the destination. |
| + * @param {print_preview.Destination.Type} type Type of the destination. |
|
dpapad
2012/05/25 16:18:03
Nit: !print_preview.Destination.Type.
Robert Toscano
2012/05/25 19:47:01
This is a typedef of a string, so I don't think th
|
| * @param {string} displayName Display name of the destination. |
| * @param {boolean} isRecent Whether the destination has been used recently. |
| - * @param {boolean} isLocal Whether the destination is local or cloud-based. |
| * @param {Array.<string>=} opt_tags Tags associated with the destination. |
| + * @param {boolean=} opt_isOwned Whether the destination is owned by the user. |
| + * Only applies to cloud-based destinations. |
| * @constructor |
| */ |
| - function Destination(id, displayName, isRecent, isLocal, opt_tags) { |
| + function Destination(id, type, displayName, isRecent, opt_tags, opt_isOwned) { |
| /** |
| * ID of the destination. |
| * @type {string} |
| @@ -24,6 +26,13 @@ cr.define('print_preview', function() { |
| this.id_ = id; |
| /** |
| + * Type of the destination. |
| + * @type {print_preview.Destination.Type} |
|
dpapad
2012/05/25 16:18:03
Same here.
Robert Toscano
2012/05/25 19:47:01
See answer above.
|
| + * @private |
| + */ |
| + this.type_ = type; |
| + |
| + /** |
| * Display name of the destination. |
| * @type {string} |
| * @private |
| @@ -38,13 +47,6 @@ cr.define('print_preview', function() { |
| this.isRecent_ = isRecent; |
| /** |
| - * Whether the destination is local or cloud-based. |
| - * @type {boolean} |
| - * @private |
| - */ |
| - this.isLocal_ = isLocal; |
| - |
| - /** |
| * Tags associated with the destination. |
| * @type {!Array.<string>} |
| * @private |
| @@ -59,8 +61,15 @@ cr.define('print_preview', function() { |
| this.capabilities_ = null; |
| /** |
| + * Whether the destination is owned by the user. |
| + * @type {boolean} |
| + * @private |
| + */ |
| + this.isOwned_ = opt_isOwned || false; |
| + |
| + /** |
| * Cache of destination location fetched from tags. |
| - * @type {string} |
| + * @type {?string} |
| * @private |
| */ |
| this.location_ = null; |
| @@ -79,8 +88,18 @@ cr.define('print_preview', function() { |
| */ |
| Destination.GooglePromotedId = { |
| DOCS: '__google__docs', |
| - SAVE_AS_PDF: 'Save as PDF', |
| - PRINT_WITH_CLOUD_PRINT: 'printWithCloudPrint' |
| + FEDEX: '__google__fedex', |
| + SAVE_AS_PDF: 'Save as PDF' |
| + }; |
| + |
| + /** |
| + * Enumeration of the types of destinations. |
| + * @enum {string} |
| + */ |
| + Destination.Type = { |
| + GOOGLE: 'google', |
| + LOCAL: 'local', |
| + MOBILE: 'mobile' |
| }; |
| Destination.prototype = { |
| @@ -89,6 +108,11 @@ cr.define('print_preview', function() { |
| return this.id_; |
| }, |
| + /** @return {print_preview.Destination.Type} Type of the destination. */ |
| + get type() { |
| + return this.type_; |
| + }, |
| + |
| /** @return {string} Display name of the destination. */ |
| get displayName() { |
| return this.displayName_; |
| @@ -106,9 +130,17 @@ cr.define('print_preview', function() { |
| this.isRecent_ = isRecent; |
| }, |
| + /** |
| + * @return {boolean} Whether the user owns the destination. Only applies to |
| + * cloud-based destinations. |
| + */ |
| + get isOwned() { |
| + return this.isOwned_; |
| + }, |
| + |
| /** @return {boolean} Whether the destination is local or cloud-based. */ |
| get isLocal() { |
| - return this.isLocal_; |
| + return this.type_ == Destination.Type.LOCAL; |
| }, |
| /** @return {boolean} Whether the destination is promoted by Google. */ |
| @@ -122,14 +154,6 @@ cr.define('print_preview', function() { |
| }, |
| /** |
| - * @return {boolean} Whether the destination is the "Print with Cloud Print" |
| - * destination. |
| - */ |
| - get isPrintWithCloudPrint() { |
| - return this.id_ == Destination.GooglePromotedId.PRINT_WITH_CLOUD_PRINT; |
| - }, |
| - |
| - /** |
| * @return {string} The location of the destination, or an empty string if |
| * the location is unknown. |
| */ |