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

Unified Diff: chrome/browser/resources/print_preview/data/destination.js

Issue 1144983002: Introduce concept of provisional destinations to print preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
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 edce220a5ee90ffeeefcfb3a9a5f32978b014d4a..9648080350884de858fcb5bbe4512b1218cb74a7 100644
--- a/chrome/browser/resources/print_preview/data/destination.js
+++ b/chrome/browser/resources/print_preview/data/destination.js
@@ -56,6 +56,7 @@ cr.define('print_preview', function() {
* cloudID: (string|undefined),
* extensionId: (string|undefined),
* extensionName: (string|undefined),
+ * usbId: (number | undefined),
* description: (string|undefined)}=} opt_params Optional parameters
* for the destination.
* @constructor
@@ -167,6 +168,12 @@ cr.define('print_preview', function() {
* @private {string}
*/
this.extensionName_ = (opt_params && opt_params.extensionName) || '';
+
+ /** @private {Destination.ProvisionalType} */
+ this.provisionalType_ = Destination.ProvisionalType.NONE;
+
+ /** @private {?number} */
+ this.usbId_ = (opt_params && opt_params.usbId) || null;
};
/**
@@ -225,6 +232,11 @@ cr.define('print_preview', function() {
UNREGISTERED: 'UNREGISTERED'
};
+ Destination.ProvisionalType = {
+ NONE: 'NONE',
+ NEEDS_USB_PERMISSION: 'NEEDS_USB_PERMISSION'
+ };
+
/**
* Enumeration of relative icon URLs for various types of destinations.
* @enum {string}
@@ -501,6 +513,32 @@ cr.define('print_preview', function() {
this.extraPropertiesToMatch.some(function(property) {
return property.match(query);
});
+ },
+
+ /** @return {Destination.ProvisionalType} */
+ get provisionalType() {
+ return this.provisionalType_;
+ },
+
+ /** @param {Destination.ProvisionalType} type */
+ set provisionalType(type) {
+ if (type == Destination.ProvisionalType.NEDS_USB_PERMISSION) {
+ assert(this.extensionId != null,
+ 'Provisional USB destination with no extension ID set.');
+ assert(this.usbId != null,
+ 'Provisional USB destination with no USB ID set.');
+ }
+ this.provisionalType_ = type;
+ },
+
+ /** @return {boolean} */
+ get isProvisional() {
+ return this.provisionalType_ != Destination.ProvisionalType.NONE;
+ },
+
+ /** @return {?number} */
+ get usbId() {
+ return this.usbId_;
}
};

Powered by Google App Engine
This is Rietveld 408576698