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

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

Issue 1144983002: Introduce concept of provisional destinations to print preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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 8c72a538284ac3e98bdaeda005022f06bf5b9754..621670a2e6d11a7eeeb88ab15776da69b3aa5113 100644
--- a/chrome/browser/resources/print_preview/native_layer.js
+++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -67,6 +67,10 @@ cr.define('print_preview', function() {
this.onEnableManipulateSettingsForTest_.bind(this);
global.printPresetOptionsFromDocument =
this.onPrintPresetOptionsFromDocument_.bind(this);
+ global.onProvisionalDestinationResolved =
+ this.onProvisionalDestinationResolved_.bind(this);
+ global.failedToResolveProvisionalDestination =
+ this.failedToResolveProvisionalDestination_.bind(this);
};
/**
@@ -106,6 +110,8 @@ cr.define('print_preview', function() {
EXTENSION_CAPABILITIES_SET:
'print_preview.NativeLayer.EXTENSION_CAPABILITIES_SET',
PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS',
+ EXTENSION_USB_PRINTER_RESOLVED:
+ 'print_preview.NativeLayer.EXTENSION_USB_PRINTER_RESOLVED'
};
/**
@@ -214,6 +220,17 @@ cr.define('print_preview', function() {
},
/**
+ * @param {string} provisionalDestinationId
+ * @param {string} extensionId
+ * @param {!number} usbId
+ */
+ grantUsbExtensionPermission:
+ function(provisionalDestinationId, extensionId, usbId) {
+ chrome.send('grantExtensionUsbPrinterAccess',
+ [provisionalDestinationId, extensionId, usbId]);
+ },
+
+ /**
* @param {!print_preview.Destination} destination Destination to print to.
* @param {!print_preview.ticket_items.Color} color Color ticket item.
* @return {number} Native layer color model.
@@ -529,6 +546,23 @@ cr.define('print_preview', function() {
this.dispatchEvent(getCapsFailEvent);
},
+ failedToResolveProvisionalDestination_: function(provisionalDestinationId) {
+ var evt = new Event(
+ NativeLayer.EventType.EXTENSION_USB_PRINTER_RESOLVED);
+ evt.provisionalId = provisionalDestinationId;
+ evt.destination = null;
+ this.dispatchEvent(evt);
+ },
+
+ onProvisionalDestinationResolved_: function(provisionalDestinationId,
+ destinationInfo) {
+ var evt = new Event(
+ NativeLayer.EventType.EXTENSION_USB_PRINTER_RESOLVED);
+ evt.provisionalId = provisionalDestinationId;
+ evt.destination = destinationInfo;
+ this.dispatchEvent(evt);
+ },
+
/**
* Called when native layer gets settings information for a requested privet
* destination.

Powered by Google App Engine
This is Rietveld 408576698