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

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

Issue 2919693002: Print Preview: Change getPrinters to cr.sendWithPromise (Closed)
Patch Set: Fix comments Created 3 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_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 116b1c64ee0f5fcb3fff3e44a513e9c1ef7009b6..a480c4f87cb453c1b0f0f1fbe4d191beb5b31666 100644
--- a/chrome/browser/resources/print_preview/data/destination_store.js
+++ b/chrome/browser/resources/print_preview/data/destination_store.js
@@ -1078,7 +1078,14 @@ cr.define('print_preview', function() {
startLoadLocalDestinations: function() {
if (!this.hasLoadedAllLocalDestinations_) {
this.hasLoadedAllLocalDestinations_ = true;
- this.nativeLayer_.startGetLocalDestinations();
+ this.nativeLayer_.getPrinters().then(
dpapad 2017/06/01 19:01:53 Isn't this equivalent to this.nativeLayer_.getPri
rbpotter 2017/06/01 22:31:12 Done.
+ /**
+ * @param {Array<print_preview.LocalDestinationInfo>}
+ * destinationInfos A list of the local destinations retrieved.
+ */
+ function(destinationInfos) {
+ this.onLocalDestinationsSet_(destinationInfos);
+ }.bind(this));
this.isLocalDestinationSearchInProgress_ = true;
dpapad 2017/06/01 19:01:53 Not for this CL, mostly brainstorming: I am seein
rbpotter 2017/06/01 22:31:12 Acknowledged.
cr.dispatchSimpleEvent(
this, DestinationStore.EventType.DESTINATION_SEARCH_STARTED);
@@ -1362,10 +1369,6 @@ cr.define('print_preview', function() {
var nativeLayerEventTarget = this.nativeLayer_.getEventTarget();
this.tracker_.add(
nativeLayerEventTarget,
- print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET,
- this.onLocalDestinationsSet_.bind(this));
- this.tracker_.add(
- nativeLayerEventTarget,
print_preview.NativeLayer.EventType.CAPABILITIES_SET,
this.onLocalDestinationCapabilitiesSet_.bind(this));
this.tracker_.add(
@@ -1437,11 +1440,12 @@ cr.define('print_preview', function() {
/**
* Called when the local destinations have been got from the native layer.
- * @param {Event} event Contains the local destinations.
+ * @param {Array<print_preview.LocalDestinationInfo>} destinationInfos A
dpapad 2017/06/01 19:01:53 Should this be !Array<!print_preview.LocalDestinat
rbpotter 2017/06/01 22:31:12 Done.
+ * list of the local destinations retrieved.
* @private
*/
- onLocalDestinationsSet_: function(event) {
- var localDestinations = event.destinationInfos.map(function(destInfo) {
+ onLocalDestinationsSet_: function(destinationInfos) {
+ var localDestinations = destinationInfos.map(function(destInfo) {
return print_preview.LocalDestinationParser.parse(destInfo);
});
this.insertDestinations_(localDestinations);

Powered by Google App Engine
This is Rietveld 408576698