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

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

Issue 2606043004: Perform printer setup on Chrome OS before selecting printer. (Closed)
Patch Set: Created 4 years 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_store.js
diff --git a/chrome/browser/resources/print_preview/data/destination_store.js b/chrome/browser/resources/print_preview/data/destination_store.js
index dafd6553b237f3a68c0e279e159bd63c44167ed7..696f953c11cd915c6b868eb75fb245e893985a4e 100644
--- a/chrome/browser/resources/print_preview/data/destination_store.js
+++ b/chrome/browser/resources/print_preview/data/destination_store.js
@@ -776,7 +776,8 @@ cr.define('print_preview', function() {
this.autoSelectMatchingDestination_ =
this.createExactDestinationMatch_(origin, id);
- if (origin == print_preview.Destination.Origin.LOCAL) {
+ if (origin == print_preview.Destination.Origin.LOCAL ||
+ origin == print_preview.Destination.Origin.CROS) {
this.nativeLayer_.startGetLocalDestinationCapabilities(id);
return true;
}
@@ -902,6 +903,7 @@ cr.define('print_preview', function() {
origins.push(print_preview.Destination.Origin.LOCAL);
origins.push(print_preview.Destination.Origin.PRIVET);
origins.push(print_preview.Destination.Origin.EXTENSION);
+ origins.push(print_preview.Destination.Origin.CROS);
}
if (isCloud) {
origins.push(print_preview.Destination.Origin.COOKIES);
@@ -1083,6 +1085,10 @@ cr.define('print_preview', function() {
}
},
+ resolveCrosDestination: function(destination) {
+ this.nativeLayer_.setupPrinter(destination.id);
+ },
+
/**
* Attempts to resolve a provisional destination.
* @param {!print_preview.Destination} destinaion Provisional destination
@@ -1272,6 +1278,20 @@ cr.define('print_preview', function() {
},
/**
+ * Handle the result of a PRINTER_SETUP request.
+ * @param {!Event} evt event carrying the results.
+ * @private
+ */
+ handleCrosDestinationResolved_: function(evt) {
+ var event = new Event(
+ DestinationStore.EventType.PRINTER_CONFIGURED);
xdai1 2016/12/30 00:38:13 Seems there is no DestinationStore.EventType.PRINT
skau 2017/01/04 18:57:06 Looks like it was left out of the CL somehow. It'
+ event.printerId = evt.printerId;
+ event.capabilities = evt.capabilities;
+ event.success = evt.success;
+ this.dispatchEvent(event);
+ },
+
+ /**
* Inserts {@code destination} to the data store and dispatches a
* DESTINATIONS_INSERTED event.
* @param {!print_preview.Destination} destination Print destination to
@@ -1456,6 +1476,10 @@ cr.define('print_preview', function() {
this.nativeLayer_,
print_preview.NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED,
this.handleProvisionalDestinationResolved_.bind(this));
+ this.tracker_.add(
+ this.nativeLayer_,
+ print_preview.NativeLayer.EventType.PRINTER_SETUP,
+ this.handleCrosDestinationResolved_.bind(this));
},
/**

Powered by Google App Engine
This is Rietveld 408576698