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

Unified Diff: chrome/browser/resources/print_preview/print_preview.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/print_preview.js
diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
index 5b8e91413bb405a6088ef73f0e6e15e2f02518be..8397e18a1aea00ee49b81d5593eef3f52164b3f7 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -262,6 +262,11 @@ cr.define('print_preview', function() {
this.nativeLayer_,
print_preview.NativeLayer.EventType.DISABLE_SCALING,
this.onDisableScaling_.bind(this));
+ this.tracker.add(
+ this.nativeLayer_,
+ print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED,
+ this.onPrivetPrintFailed_.bind(this));
+
this.tracker.add(
$('system-dialog-link'),
@@ -408,6 +413,7 @@ cr.define('print_preview', function() {
this.setIsEnabled_(false);
if (this.printIfReady_() &&
((this.destinationStore_.selectedDestination.isLocal &&
+ !this.destinationStore_.selectedDestination.isPrivet &&
this.destinationStore_.selectedDestination.id !=
print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) ||
this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW)) {
@@ -804,6 +810,18 @@ cr.define('print_preview', function() {
},
/**
+ * Called when privet printing fails.
+ * @param {Event} event Event object representing the failure.
+ * @private
+ */
+ onPrivetPrintFailed_: function(event) {
+ console.error('Privet printing failed with error code ' +
+ event.httpError);
+ this.close_();
+ },
+
+
+ /**
* Called when the open-cloud-print-dialog link is clicked. Opens the Google
* Cloud Print web dialog.
* @private

Powered by Google App Engine
This is Rietveld 408576698