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

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

Issue 140323002: Reset margins when destination selected, not when capabilities are ready. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview/data/print_ticket_store.js
diff --git a/chrome/browser/resources/print_preview/data/print_ticket_store.js b/chrome/browser/resources/print_preview/data/print_ticket_store.js
index 9ca5a8ac88b1d0fd115df459c8131cd553f84cd8..267b539ee3919aab054042632005fdf66d2f65db 100644
--- a/chrome/browser/resources/print_preview/data/print_ticket_store.js
+++ b/chrome/browser/resources/print_preview/data/print_ticket_store.js
@@ -390,6 +390,11 @@ cr.define('print_preview', function() {
addEventListeners_: function() {
this.tracker_.add(
this.destinationStore_,
+ print_preview.DestinationStore.EventType.DESTINATION_SELECT,
+ this.onDestinationSelect_.bind(this));
+
+ this.tracker_.add(
+ this.destinationStore_,
print_preview.DestinationStore.EventType.
SELECTED_DESTINATION_CAPABILITIES_READY,
this.onSelectedDestinationCapabilitiesReady_.bind(this));
@@ -411,6 +416,22 @@ cr.define('print_preview', function() {
},
/**
+ * Called when the destination selected.
+ * @private
+ */
+ onDestinationSelect_: function() {
+ // Reset user selection for certain ticket items.
+ if (this.capabilitiesHolder_.get() != null) {
+ this.customMargins_.updateValue(null);
+ if (this.marginsType_.getValue() ==
+ print_preview.ticket_items.MarginsType.Value.CUSTOM) {
+ this.marginsType_.updateValue(
+ print_preview.ticket_items.MarginsType.Value.DEFAULT);
+ }
+ }
+ },
+
+ /**
* Called when the capabilities of the selected destination are ready.
* @private
*/
@@ -422,14 +443,6 @@ cr.define('print_preview', function() {
this.isInitialized_ = true;
cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.INITIALIZE);
} else {
- // Reset user selection for certain ticket items.
- this.customMargins_.updateValue(null);
-
- if (this.marginsType_.getValue() ==
- print_preview.ticket_items.MarginsType.Value.CUSTOM) {
- this.marginsType_.updateValue(
- print_preview.ticket_items.MarginsType.Value.DEFAULT);
- }
cr.dispatchSimpleEvent(
this, PrintTicketStore.EventType.CAPABILITIES_CHANGE);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698