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

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

Issue 2918243002: Change getExtensionPrinters to cr.sendWithPromise (Closed)
Patch Set: Fix comment 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 4ad76dea1179c79c459e089a01e900fc107a49e3..30bc22b4d1c9ce2408f40509f7a4b894a9983633 100644
--- a/chrome/browser/resources/print_preview/native_layer.js
+++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -73,8 +73,6 @@ cr.define('print_preview', function() {
global.onPrivetCapabilitiesSet =
this.onPrivetCapabilitiesSet_.bind(this);
global.onPrivetPrintFailed = this.onPrivetPrintFailed_.bind(this);
- global.onExtensionPrintersAdded =
- this.onExtensionPrintersAdded_.bind(this);
global.onExtensionCapabilitiesSet =
this.onExtensionCapabilitiesSet_.bind(this);
global.onEnableManipulateSettingsForTest =
@@ -142,8 +140,6 @@ cr.define('print_preview', function() {
PRIVET_CAPABILITIES_SET:
'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET',
PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED',
- EXTENSION_PRINTERS_ADDED:
- 'print_preview.NativeLayer.EXTENSION_PRINTERS_ADDED',
EXTENSION_CAPABILITIES_SET:
'print_preview.NativeLayer.EXTENSION_CAPABILITIES_SET',
PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS',
@@ -263,11 +259,13 @@ cr.define('print_preview', function() {
},
/**
- * Requests that extension system dispatches an event requesting the list of
- * extension managed printers.
+ * Request a list of extension printers. Printers are reported as they are
+ * found by a series of 'extension-printers-added' events.
+ * @return {!Promise} Will be resolved when all extension managed printers
+ * have been sent.
*/
- startGetExtensionDestinations: function() {
- chrome.send('getExtensionPrinters');
+ getExtensionPrinters: function() {
+ return cr.sendWithPromise('getExtensionPrinters');
},
/**
@@ -821,24 +819,6 @@ cr.define('print_preview', function() {
this.eventTarget_.dispatchEvent(privetPrintFailedEvent);
},
- /**
- * @param {Array<!{extensionId: string,
- * extensionName: string,
- * id: string,
- * name: string,
- * description: (string|undefined),
- * provisional: (boolean|undefined)}>} printers The list
- * containing information about printers added by an extension.
- * @param {boolean} done Whether this is the final list of extension
- * managed printers.
- */
- onExtensionPrintersAdded_: function(printers, done) {
- var event = new Event(NativeLayer.EventType.EXTENSION_PRINTERS_ADDED);
- event.printers = printers;
- event.done = done;
- this.eventTarget_.dispatchEvent(event);
- },
-
/**
* Called when an extension responds to a request for an extension printer
* capabilities.

Powered by Google App Engine
This is Rietveld 408576698