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

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

Issue 2918243002: Change getExtensionPrinters to cr.sendWithPromise (Closed)
Patch Set: Fix 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/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..4751555e25ee7377f0cc4f447b476abdade77981 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',
@@ -265,9 +261,11 @@ cr.define('print_preview', function() {
/**
* Requests that extension system dispatches an event requesting the list of
* extension managed printers.
+ * @return {!Promise<boolean>} 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