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

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

Issue 59843010: Print to Privet local printers (PDF only) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 7a2fa366a6517787598b42f834fbd1350b1b3ec2..ddc57eaecc43fdd5bbfe6ddd696f6e0f0541512d 100644
--- a/chrome/browser/resources/print_preview/native_layer.js
+++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -48,6 +48,7 @@ cr.define('print_preview', function() {
this.onPrivetPrinterSearchDone_.bind(this);
global['onPrivetCapabilitiesSet'] =
this.onPrivetCapabilitiesSet_.bind(this);
+ global['onPrivetPrintFailed'] = this.onPrivetPrintFailed_.bind(this);
};
/**
@@ -81,7 +82,8 @@ cr.define('print_preview', function() {
PRIVET_PRINTER_SEARCH_DONE:
'print_preview.NativeLayer.PRIVET_PRINTER_SEARCH_DONE',
PRIVET_CAPABILITIES_SET:
- 'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET'
+ 'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET',
+ PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED'
};
/**
@@ -273,6 +275,7 @@ cr.define('print_preview', function() {
'printToPDF': destination.id ==
print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
'printWithCloudPrint': !destination.isLocal,
+ 'printWithPrivet': destination.isPrivet,
'deviceName': destination.id,
'isFirstRequest': false,
'requestID': -1,
@@ -300,6 +303,10 @@ cr.define('print_preview', function() {
};
}
+ if (destination.isPrivet) {
+ ticket['ticket'] = printTicketStore.createPrintTicket(destination);
+ }
+
if (opt_isOpenPdfInPreview) {
ticket['OpenPDFInPreview'] = true;
}
@@ -670,6 +677,17 @@ cr.define('print_preview', function() {
privetCapabilitiesSetEvent.printer = printer;
privetCapabilitiesSetEvent.capabilities = capabilities;
this.dispatchEvent(privetCapabilitiesSetEvent);
+ },
+
+ /**
+ * @param {number} http_error HTTP Error code for the privet local error.
+ * @private
+ */
+ onPrivetPrintFailed_: function(http_error) {
+ var privetPrintFailedEvent = new Event(
+ NativeLayer.EventType.PRIVET_PRINT_FAILED);
Toscano 2013/11/06 22:05:35 Needs two more spaces indent.
Toscano 2013/11/06 22:05:35 Should break on higher order operator: var privet
Noam Samuel 2013/11/06 23:59:11 Done.
+ privetPrintFailedEvent.http_error = http_error;
+ this.dispatchEvent(privetPrintFailedEvent);
}
};

Powered by Google App Engine
This is Rietveld 408576698