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

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: Review feedback (swap checks, update comments) 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..83bafbfc918d7c279577af493689eebdee7d5df3 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -347,8 +347,8 @@ cr.define('print_preview', function() {
this.onSettingsInvalid_.bind(this));
this.tracker.add(
this.nativeLayer_,
- print_preview.NativeLayer.EventType.DISABLE_SCALING,
- this.onDisableScaling_.bind(this));
+ print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS,
+ this.onPrintPresetOptionsFromDocument_.bind(this));
this.tracker.add(
this.nativeLayer_,
print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED,
@@ -979,13 +979,22 @@ cr.define('print_preview', function() {
},
/**
- * Called when the native layer dispatches a DISABLE_SCALING event. Resets
- * fit-to-page selection and updates document info.
+ * Updates printing options according to source document presets.
+ * @param {Event} event Contains options from source document.
* @private
*/
- onDisableScaling_: function() {
- this.printTicketStore_.fitToPage.updateValue(null);
- this.documentInfo_.updateIsScalingDisabled(true);
+ onPrintPresetOptionsFromDocument_: function(event) {
+ if (event.optionsFromDocument.disableScaling) {
+ // Reset fit-to-page selection and update document info.
Aleksey Shlyapnikov 2014/11/24 19:47:58 Remove this comment, it states the obvious now.
Nikhil 2014/11/25 06:36:13 Done.
+ this.printTicketStore_.fitToPage.updateValue(null);
+ this.documentInfo_.updateIsScalingDisabled(true);
+ }
+
+ if (event.optionsFromDocument.copies > 0 &&
+ this.printTicketStore_.copies.isCapabilityAvailable()) {
+ this.printTicketStore_.copies.updateValue(
+ event.optionsFromDocument.copies);
+ }
},
/**

Powered by Google App Engine
This is Rietveld 408576698