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

Side by Side Diff: chrome/browser/resources/print_preview/settings/margin_settings.js

Issue 10450022: Print Preview Print Destination Search Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Set --bary flag Created 8 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a MarginSettings object. This object encapsulates all settings and 9 * Creates a MarginSettings object. This object encapsulates all settings and
10 * logic related to the margins mode. 10 * logic related to the margins mode.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 }, 70 },
71 71
72 /** 72 /**
73 * Called when the select element is changed. Updates the print ticket 73 * Called when the select element is changed. Updates the print ticket
74 * margin type. 74 * margin type.
75 * @private 75 * @private
76 */ 76 */
77 onSelectChange_: function() { 77 onSelectChange_: function() {
78 var select = this.select_; 78 var select = this.select_;
79 var marginsType = 79 var marginsType =
80 /** @type {print_preview.ticket_items.MarginsType.Value} */ ( 80 /** @type {!print_preview.ticket_items.MarginsType.Value} */ (
81 select.selectedIndex); 81 select.selectedIndex);
82 this.printTicketStore_.updateMarginsType(marginsType); 82 this.printTicketStore_.updateMarginsType(marginsType);
83 }, 83 },
84 84
85 /** 85 /**
86 * Called when the print ticket store changes. Selects the corresponding 86 * Called when the print ticket store changes. Selects the corresponding
87 * select option. 87 * select option.
88 * @private 88 * @private
89 */ 89 */
90 onPrintTicketStoreChange_: function() { 90 onPrintTicketStoreChange_: function() {
91 if (this.printTicketStore_.hasMarginsCapability()) { 91 if (this.printTicketStore_.hasMarginsCapability()) {
92 var select = this.select_; 92 var select = this.select_;
93 var marginsType = this.printTicketStore_.getMarginsType(); 93 var marginsType = this.printTicketStore_.getMarginsType();
94 var selectedMarginsType = 94 var selectedMarginsType =
95 /** @type {print_preview.ticket_items.MarginsType.Value} */ ( 95 /** @type {!print_preview.ticket_items.MarginsType.Value} */ (
96 select.selectedIndex); 96 select.selectedIndex);
97 if (marginsType != selectedMarginsType) { 97 if (marginsType != selectedMarginsType) {
98 select.options[selectedMarginsType].selected = false; 98 select.options[selectedMarginsType].selected = false;
99 select.options[marginsType].selected = true; 99 select.options[marginsType].selected = true;
100 } 100 }
101 fadeInOption(this.getElement()); 101 fadeInOption(this.getElement());
102 } else { 102 } else {
103 fadeOutOption(this.getElement()); 103 fadeOutOption(this.getElement());
104 } 104 }
105 } 105 }
106 }; 106 };
107 107
108 // Export 108 // Export
109 return { 109 return {
110 MarginSettings: MarginSettings 110 MarginSettings: MarginSettings
111 }; 111 };
112 }); 112 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698