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

Side by Side Diff: chrome/browser/resources/print_preview/copies_settings.js

Issue 7358002: Print Preview: Refactoring layout mode related logic to LayoutSettings class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moving function within CopiesSettings Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CopiesSettings object. 9 * Creates a CopiesSettings object.
10 * @constructor 10 * @constructor
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 /** 48 /**
49 * Getter method for |twoSidedCheckbox_|. 49 * Getter method for |twoSidedCheckbox_|.
50 * @type {HTMLInputElement} 50 * @type {HTMLInputElement}
51 */ 51 */
52 get twoSidedCheckbox() { 52 get twoSidedCheckbox() {
53 return this.twoSidedCheckbox_; 53 return this.twoSidedCheckbox_;
54 }, 54 },
55 55
56 /** 56 /**
57 * Gets the duplex mode for printing.
58 * @return {number} duplex mode.
59 */
60 get duplexMode() {
61 // Constant values matches printing::DuplexMode enum. Not using const
62 // keyword because it is not allowed by JS strict mode.
63 var SIMPLEX = 0;
64 var LONG_EDGE = 1;
65 return !this.twoSidedCheckbox_.checked ? SIMPLEX : LONG_EDGE;
66 },
67
68 /**
57 * @return {boolean} true if |this.textfield_| is empty, or represents a 69 * @return {boolean} true if |this.textfield_| is empty, or represents a
58 * positive integer value. 70 * positive integer value.
59 */ 71 */
60 isValid: function() { 72 isValid: function() {
61 return !this.textfield_.value || isPositiveInteger(this.textfield_.value); 73 return !this.textfield_.value || isPositiveInteger(this.textfield_.value);
62 }, 74 },
63 75
64 /** 76 /**
65 * Resets |this.textfield_| to |this.minValue_|. 77 * Resets |this.textfield_| to |this.minValue_|.
66 * @private 78 * @private
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 this.decrementButton_.disabled = this.numberOfCopies == this.minValue_; 175 this.decrementButton_.disabled = this.numberOfCopies == this.minValue_;
164 fadeOutElement(this.hint_); 176 fadeOutElement(this.hint_);
165 } 177 }
166 } 178 }
167 }; 179 };
168 180
169 return { 181 return {
170 CopiesSettings: CopiesSettings, 182 CopiesSettings: CopiesSettings,
171 }; 183 };
172 }); 184 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698