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

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

Issue 407733002: [JS Changes] Support NumCopies print preset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Name changes Created 6 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 673b8d89ef191a18ce356069d2512ed1080f5780..68ac675db0055eb6dae9a08d4fac104e4f7511a9 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -351,6 +351,10 @@ cr.define('print_preview', function() {
this.onDisableScaling_.bind(this));
this.tracker.add(
this.nativeLayer_,
+ print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS,
+ this.onPrintPresetOptionsFromDocument_.bind(this));
+ this.tracker.add(
+ this.nativeLayer_,
print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED,
this.onPrivetPrintFailed_.bind(this));
this.tracker.add(
@@ -989,6 +993,24 @@ cr.define('print_preview', function() {
},
/**
+ * Called when the native layer dispatches a PRINT_PRESET_OPTIONS event. It
+ * updates the print preset options from source document.
+ * @param {event} event Contains options from source document.
+ * @private
+ */
+ onPrintPresetOptionsFromDocument_: function(event) {
+ if (event.optionsFromDocument.fitToPageEnabled) {
+ this.printTicketStore_.fitToPage.updateValue(null);
+ this.documentInfo_.updateIsScalingDisabled(true);
+ }
+
+ if (event.optionsFromDocument.copies) {
Aleksey Shlyapnikov 2014/11/20 18:56:56 Check this.printTicketStore_.copies.isCapabilityAv
Nikhil 2014/11/21 10:45:32 NumCopies property spec doesn't say anything speci
Aleksey Shlyapnikov 2014/11/21 22:50:41 I agree and that's why I suggested to add this.pri
+ this.printTicketStore_.copies.updateValue(
+ event.optionsFromDocument.copies);
Aleksey Shlyapnikov 2014/11/20 18:56:56 Two more spaces indent.
Nikhil 2014/11/21 10:45:32 Done.
+ }
+ },
+
+ /**
* Called when privet printing fails.
* @param {Event} event Event object representing the failure.
* @private

Powered by Google App Engine
This is Rietveld 408576698