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

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 (add kSettingDisableScaling, remove dead code) 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..c3ea3fb349509c9fb5fd8abbf40d591fb403d6f6 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));
Aleksey Shlyapnikov 2014/11/21 22:50:42 Please remove _all_ obsolete code.
Nikhil 2014/11/24 12:57:30 Done.
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,23 @@ cr.define('print_preview', function() {
},
Aleksey Shlyapnikov 2014/11/21 22:50:42 Please remove _all_ obsolete code.
Nikhil 2014/11/24 12:57:30 Done.
/**
+ * Called when the native layer dispatches a PRINT_PRESET_OPTIONS event. It
+ * updates the print preset options from source document.
Aleksey Shlyapnikov 2014/11/21 22:50:42 Just one sentence: Updates printing options accor
Nikhil 2014/11/24 12:57:30 Done.
+ * @param {event} event Contains options from source document.
Aleksey Shlyapnikov 2014/11/21 22:50:42 event -> Event
Nikhil 2014/11/24 12:57:30 Done.
+ * @private
+ */
+ onPrintPresetOptionsFromDocument_: function(event) {
+ if (event.optionsFromDocument.disableScaling)
+ this.onDisableScaling_();
+
+ if (this.printTicketStore_.copies.isCapabilityAvailable() &&
+ event.optionsFromDocument.copies) {
Aleksey Shlyapnikov 2014/11/21 22:50:42 Let's swap checks and add sanity check: if (event
Nikhil 2014/11/24 12:57:30 Done.
+ this.printTicketStore_.copies.updateValue(
+ event.optionsFromDocument.copies);
+ }
+ },
+
+ /**
* Called when privet printing fails.
* @param {Event} event Event object representing the failure.
* @private

Powered by Google App Engine
This is Rietveld 408576698