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

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 (nit fixes for test case) Created 6 years 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..19d7a693350f82461fd6b43a86e832f6f7542d10 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,21 @@ 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) {
+ 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);
+ }
},
/**
« no previous file with comments | « chrome/browser/resources/print_preview/native_layer.js ('k') | chrome/browser/ui/webui/print_preview/print_preview_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698