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

Unified Diff: chrome/browser/resources/print_preview/native_layer.js

Issue 2920153004: Print Preview: Change getPrivetPrinters to cr.sendWithPromise (Closed)
Patch Set: Change notation Created 3 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/native_layer.js
diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js
index 30bc22b4d1c9ce2408f40509f7a4b894a9983633..5c480de4ca131b45ab43f3e32738d05f8e021d64 100644
--- a/chrome/browser/resources/print_preview/native_layer.js
+++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -69,7 +69,6 @@ cr.define('print_preview', function() {
global.onDidPreviewPage = this.onDidPreviewPage_.bind(this);
global.updatePrintPreview = this.onUpdatePrintPreview_.bind(this);
global.onDidGetAccessToken = this.onDidGetAccessToken_.bind(this);
- global.onPrivetPrinterChanged = this.onPrivetPrinterChanged_.bind(this);
global.onPrivetCapabilitiesSet =
this.onPrivetCapabilitiesSet_.bind(this);
global.onPrivetPrintFailed = this.onPrivetPrintFailed_.bind(this);
@@ -233,20 +232,13 @@ cr.define('print_preview', function() {
},
/**
- * Requests the network's privet print destinations. A number of
- * PRIVET_PRINTER_CHANGED events will be fired in response, followed by a
- * PRIVET_SEARCH_ENDED.
+ * Requests the network's privet print destinations. After this is called,
+ * a number of privet-printer-changed events may be fired.
+ * @return {!Promise} Resolves when privet printer search is completed.
+ * Rejected if privet printers are not enabled.
*/
- startGetPrivetDestinations: function() {
- chrome.send('getPrivetPrinters');
- },
-
- /**
- * Requests that the privet print stack stop searching for privet print
- * destinations.
- */
- stopGetPrivetDestinations: function() {
- chrome.send('stopGetPrivetPrinters');
+ getPrivetPrinters: function() {
+ return cr.sendWithPromise('getPrivetPrinters');
},
/**
@@ -782,18 +774,6 @@ cr.define('print_preview', function() {
this.eventTarget_.dispatchEvent(printPresetOptionsEvent);
},
- /**
- * @param {{serviceName: string, name: string}} printer Specifies
- * information about the printer that was added.
- * @private
- */
- onPrivetPrinterChanged_: function(printer) {
- var privetPrinterChangedEvent =
- new Event(NativeLayer.EventType.PRIVET_PRINTER_CHANGED);
- privetPrinterChangedEvent.printer = printer;
- this.eventTarget_.dispatchEvent(privetPrinterChangedEvent);
- },
-
/**
* @param {Object} printer Specifies information about the printer that was
* added.

Powered by Google App Engine
This is Rietveld 408576698