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

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

Issue 2861713004: Print Preview: Fix compile errors in settings/ directory (Closed)
Patch Set: Address comments and fix remaining lint errors Created 3 years, 7 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 * Component that renders the scaling settings UI. 9 * Component that renders the scaling settings UI.
10 * @param {!print_preview.ticket_items.scalingTicketItem} scalingTicketItem 10 * @param {!print_preview.ticket_items.Scaling} scalingTicketItem
11 * Used to read and write the scaling value. 11 * Used to read and write the scaling value.
12 * @param {!print_preview.ticket_items.fitToPageticketItem} 12 * @param {!print_preview.ticket_items.FitToPage}
13 * fitToPageTicketItem Used to read the fit to page value. 13 * fitToPageTicketItem Used to read the fit to page value.
14 * @constructor 14 * @constructor
15 * @extends {print_preview.SettingsSection} 15 * @extends {print_preview.SettingsSection}
16 */ 16 */
17 function ScalingSettings(scalingTicketItem, fitToPageTicketItem) { 17 function ScalingSettings(scalingTicketItem, fitToPageTicketItem) {
18 print_preview.SettingsSection.call(this); 18 print_preview.SettingsSection.call(this);
19 19
20 /** 20 /**
21 * Used to read and write the scaling value. 21 * Used to read and write the scaling value.
22 * @private {!print_preview.ticket_items.Scaling} 22 * @private {!print_preview.ticket_items.Scaling}
(...skipping 23 matching lines...) Expand all
46 * @private {boolean} 46 * @private {boolean}
47 */ 47 */
48 this.isEnabled_ = true; 48 this.isEnabled_ = true;
49 49
50 /** 50 /**
51 * The textfield input element 51 * The textfield input element
52 * @private {HTMLElement} 52 * @private {HTMLElement}
53 */ 53 */
54 this.inputField_ = null; 54 this.inputField_ = null;
55 55
56 }; 56 }
57 57
58 /** 58 /**
59 * Delay in milliseconds before processing the textfield. 59 * Delay in milliseconds before processing the textfield.
60 * @private {number} 60 * @private {number}
61 * @const 61 * @const
62 */ 62 */
63 ScalingSettings.TEXTFIELD_DELAY_MS_ = 250; 63 ScalingSettings.TEXTFIELD_DELAY_MS_ = 250;
64 64
65 ScalingSettings.prototype = { 65 ScalingSettings.prototype = {
66 __proto__: print_preview.SettingsSection.prototype, 66 __proto__: print_preview.SettingsSection.prototype,
(...skipping 11 matching lines...) Expand all
78 /** @override */ 78 /** @override */
79 set isEnabled(isEnabled) { 79 set isEnabled(isEnabled) {
80 this.inputField_.disabled = !isEnabled; 80 this.inputField_.disabled = !isEnabled;
81 this.isEnabled_ = isEnabled; 81 this.isEnabled_ = isEnabled;
82 if (isEnabled) 82 if (isEnabled)
83 this.updateState_(); 83 this.updateState_();
84 }, 84 },
85 85
86 /** @override */ 86 /** @override */
87 enterDocument: function() { 87 enterDocument: function() {
88 this.inputField_ = this.getChildElement('input.user-value'); 88 this.inputField_ = assert(this.getChildElement('input.user-value'));
89 print_preview.SettingsSection.prototype.enterDocument.call(this); 89 print_preview.SettingsSection.prototype.enterDocument.call(this);
90 this.tracker.add( 90 this.tracker.add(
91 this.inputField_, 91 this.inputField_,
92 'keydown', 92 'keydown',
93 this.onTextfieldKeyDown_.bind(this)); 93 this.onTextfieldKeyDown_.bind(this));
94 this.tracker.add( 94 this.tracker.add(
95 this.inputField_, 95 this.inputField_,
96 'input', 96 'input',
97 this.onTextfieldInput_.bind(this)); 97 this.onTextfieldInput_.bind(this));
98 this.tracker.add( 98 this.tracker.add(
99 this.inputField_, 99 this.inputField_,
100 'blur', 100 'blur',
101 this.onTextfieldBlur_.bind(this)); 101 this.onTextfieldBlur_.bind(this));
102 this.tracker.add( 102 this.tracker.add(
103 this.scalingTicketItem_, 103 this.scalingTicketItem_,
104 print_preview.ticket_items.TicketItem.EventType.CHANGE, 104 print_preview.ticket_items.TicketItem.EventType.CHANGE,
105 this.updateState_.bind(this)); 105 this.updateState_.bind(this));
106 this.tracker.add( 106 this.tracker.add(
107 this.fitToPageTicketItem_, 107 this.fitToPageTicketItem_,
108 print_preview.ticket_items.TicketItem.EventType.CHANGE, 108 print_preview.ticket_items.TicketItem.EventType.CHANGE,
109 this.onFitToPageChange_.bind(this)); 109 this.onFitToPageChange_.bind(this));
110 }, 110 },
111 111
112 /** 112 /**
113 * @return {boolean} true if fit to page is available and selected. 113 * @return {boolean} true if fit to page is available and selected.
114 * @private 114 * @private
115 */ 115 */
116 isFitToPageSelected: function() { 116 isFitToPageSelected: function() {
117 return this.fitToPageTicketItem_.isCapabilityAvailable() && 117 return this.fitToPageTicketItem_.isCapabilityAvailable() &&
118 this.fitToPageTicketItem_.getValue(); 118 !!this.fitToPageTicketItem_.getValue();
119 }, 119 },
120 120
121 /** 121 /**
122 * @return {number} The current input field value as an integer. 122 * @return {number} The current input field value as an integer.
123 * @private 123 * @private
124 */ 124 */
125 getInputAsNumber: function() { 125 getInputAsNumber: function() {
126 return this.inputField_.valueAsNumber; 126 return this.inputField_.valueAsNumber;
127 }, 127 },
128 128
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 277 }
278 }, 278 },
279 279
280 }; 280 };
281 281
282 // Export 282 // Export
283 return { 283 return {
284 ScalingSettings: ScalingSettings 284 ScalingSettings: ScalingSettings
285 }; 285 };
286 }); 286 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698