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 d597f093f69240827cdd22ffc9660826516cbbef..f4a7f14e30ffa7ff9161ef7bc89dfd9235697dab 100644 |
--- a/chrome/browser/resources/print_preview/data/destination.js |
+++ b/chrome/browser/resources/print_preview/data/destination.js |
@@ -2,6 +2,38 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+cr.exportPath('print_preview'); |
+ |
+/** |
+ * The CDD (Cloud Device Description) describes the capabilities of a print |
+ * destination. |
+ * |
+ * @typedef {{ |
+ * version: string, |
+ * printer: { |
+ * vendor_capability: !Array.<{Object}>, |
+ * collate: ({default: (boolean|undefined)}|undefined), |
+ * color: ({ |
+ * option: !Array.<{ |
+ * type: (string|undefined), |
+ * vendor_id: (string|undefined), |
+ * custom_display_name: (string|undefined), |
+ * is_default: (boolean|undefined) |
+ * }> |
+ * }|undefined), |
+ * copies: ({default: (number|undefined), |
+ * max: (number|undefined)}|undefined), |
+ * duplex: ({option: !Array.<{type: (string|undefined), |
+ * is_default: (boolean|undefined)}>}|undefined), |
+ * page_orientation: ({ |
+ * option: !Array.<{type: (string|undefined), |
+ * is_default: (boolean|undefined)}> |
+ * }|undefined) |
+ * } |
+ * }} |
+ */ |
+print_preview.Cdd; |
+ |
cr.define('print_preview', function() { |
'use strict'; |
@@ -114,7 +146,7 @@ cr.define('print_preview', function() { |
* {@code null} if terms-of-service does not apply to the print destination. |
* @private {?boolean} |
*/ |
- this.isTosAccepted_ = opt_params && opt_params.isTosAccepted; |
+ this.isTosAccepted_ = !!(opt_params && opt_params.isTosAccepted); |
/** |
* Cloud ID for Privet printers. |
@@ -134,50 +166,6 @@ cr.define('print_preview', function() { |
]; |
/** |
- * Enumeration of Google-promoted destination IDs. |
- * @enum {string} |
- */ |
- Destination.GooglePromotedId = { |
- DOCS: '__google__docs', |
- 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' |
- }; |
- |
- /** |
- * Enumeration of the origin types for cloud destinations. |
- * @enum {string} |
- */ |
- Destination.Origin = { |
- LOCAL: 'local', |
- COOKIES: 'cookies', |
- PROFILE: 'profile', |
- DEVICE: 'device', |
- PRIVET: 'privet' |
- }; |
- |
- /** |
- * Enumeration of the connection statuses of printer destinations. |
- * @enum {string} |
- */ |
- Destination.ConnectionStatus = { |
- DORMANT: 'DORMANT', |
- OFFLINE: 'OFFLINE', |
- ONLINE: 'ONLINE', |
- UNKNOWN: 'UNKNOWN', |
- UNREGISTERED: 'UNREGISTERED' |
- }; |
- |
- /** |
* Enumeration of relative icon URLs for various types of destinations. |
* @enum {string} |
* @private |
@@ -423,43 +411,60 @@ cr.define('print_preview', function() { |
* {@code false} otherwise. |
*/ |
matches: function(query) { |
- return this.displayName_.match(query) || |
+ return !!this.displayName_.match(query) || |
this.extraPropertiesToMatch.some(function(property) { |
return property.match(query); |
}); |
} |
}; |
- /** |
- * The CDD (Cloud Device Description) describes the capabilities of a print |
- * destination. |
- * |
- * @typedef {{ |
- * version: string, |
- * printer: { |
- * vendor_capability: !Array.<{Object}>, |
- * collate: {default: boolean=}=, |
- * color: { |
- * option: !Array.<{ |
- * type: string=, |
- * vendor_id: string=, |
- * custom_display_name: string=, |
- * is_default: boolean= |
- * }> |
- * }=, |
- * copies: {default: number=, max: number=}=, |
- * duplex: {option: !Array.<{type: string=, is_default: boolean=}>}=, |
- * page_orientation: { |
- * option: !Array.<{type: string=, is_default: boolean=}> |
- * }= |
- * } |
- * }} |
- */ |
- var Cdd = Object; |
- |
// Export |
return { |
Destination: Destination, |
- Cdd: Cdd |
}; |
}); |
+ |
+/** |
+ * Enumeration of Google-promoted destination IDs. |
+ * @enum {string} |
+ */ |
+print_preview.Destination.GooglePromotedId = { |
+ DOCS: '__google__docs', |
+ FEDEX: '__google__fedex', |
+ SAVE_AS_PDF: 'Save as PDF' |
+}; |
+ |
+/** |
+ * Enumeration of the types of destinations. |
+ * @enum {string} |
+ */ |
+print_preview.Destination.Type = { |
+ GOOGLE: 'google', |
+ GOOGLE_PROMOTED: 'google_promoted', |
+ LOCAL: 'local', |
+ MOBILE: 'mobile' |
+}; |
+ |
+/** |
+ * Enumeration of the origin types for cloud destinations. |
+ * @enum {string} |
+ */ |
+print_preview.Destination.Origin = { |
+ LOCAL: 'local', |
+ COOKIES: 'cookies', |
+ PROFILE: 'profile', |
+ DEVICE: 'device', |
+ PRIVET: 'privet' |
+}; |
+ |
+/** |
+ * Enumeration of the connection statuses of printer destinations. |
+ * @enum {string} |
+ */ |
+print_preview.Destination.ConnectionStatus = { |
+ DORMANT: 'DORMANT', |
+ OFFLINE: 'OFFLINE', |
+ ONLINE: 'ONLINE', |
+ UNKNOWN: 'UNKNOWN', |
+ UNREGISTERED: 'UNREGISTERED' |
+}; |