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

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, 6 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..9e9c88c3af5c286c61e305234a62d8429dd1933a 100644
--- a/chrome/browser/resources/print_preview/data/destination.js
+++ b/chrome/browser/resources/print_preview/data/destination.js
@@ -54,6 +54,8 @@ cr.define('print_preview', function() {
* lastAccessTime: (number|undefined),
* isTosAccepted: (boolean|undefined),
* cloudID: (string|undefined),
+ * provisionalType:
+ * (print_preview.Destination.ProvisionalType|undefined),
* extensionId: (string|undefined),
* extensionName: (string|undefined),
* description: (string|undefined)}=} opt_params Optional parameters
@@ -167,6 +169,23 @@ cr.define('print_preview', function() {
* @private {string}
*/
this.extensionName_ = (opt_params && opt_params.extensionName) || '';
+
+ /**
+ * Different from {@code Destination.ProvisionalType.NONE} if the
+ * destination is provisional. Provisional destinations cannot be selected
+ * as they are, but have to be resolved first (i.e. extra steps have to be
+ * taken to get actual destination properties, which should replace the
+ * provisional ones). Provisional destination resolvment flow will be
+ * started when the user attempts to select the destination in search UI.
+ * @private {Destination.ProvisionalType}
+ */
+ this.provisionalType_ = (opt_params && opt_params.provisionalType) ||
+ Destination.ProvisionalType.NONE;
+
+ assert(this.provisionalType_ !=
+ Destination.ProvisionalType.NEEDS_USB_PERMISSON ||
+ this.isExtension,
+ 'Provisional USB destination only supprted with extension origin.');
};
/**
@@ -226,6 +245,21 @@ cr.define('print_preview', function() {
};
/**
+ * Enumeration specifying whether a destination is provisional and the reason
+ * the destination is provisional.
+ * @enum {string
+ */
+ Destination.ProvisionalType = {
+ /** Destination is not provisional. */
+ NONE: 'NONE',
+ /**
+ * User has to grant USB access for the destination to its provider.
+ * Used for destinations with extension origin.
+ */
+ NEEDS_USB_PERMISSION: 'NEEDS_USB_PERMISSION'
+ };
+
+ /**
* Enumeration of relative icon URLs for various types of destinations.
* @enum {string}
* @private
@@ -501,6 +535,22 @@ cr.define('print_preview', function() {
this.extraPropertiesToMatch.some(function(property) {
return property.match(query);
});
+ },
+
+ /**
+ * Gets the destination's provisional type.
+ * @return {Destination.ProvisionalType}
+ */
+ get provisionalType() {
+ return this.provisionalType_;
+ },
+
+ /**
+ * Whether the destinaion is provisional.
+ * @return {boolean}
+ */
+ get isProvisional() {
+ return this.provisionalType_ != Destination.ProvisionalType.NONE;
}
};
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/resources/print_preview/data/destination_store.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698