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

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: Remove extra semis 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 13 matching lines...) Expand all
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_ = this.getChildElement('input.user-value');
89 print_preview.SettingsSection.prototype.enterDocument.call(this); 89 print_preview.SettingsSection.prototype.enterDocument.call(this);
90 var inputField = assert(this.inputField_);
90 this.tracker.add( 91 this.tracker.add(
91 this.inputField_, 92 inputField,
92 'keydown', 93 'keydown',
93 this.onTextfieldKeyDown_.bind(this)); 94 this.onTextfieldKeyDown_.bind(this));
94 this.tracker.add( 95 this.tracker.add(
95 this.inputField_, 96 inputField,
96 'input', 97 'input',
97 this.onTextfieldInput_.bind(this)); 98 this.onTextfieldInput_.bind(this));
98 this.tracker.add( 99 this.tracker.add(
99 this.inputField_, 100 inputField,
100 'blur', 101 'blur',
101 this.onTextfieldBlur_.bind(this)); 102 this.onTextfieldBlur_.bind(this));
102 this.tracker.add( 103 this.tracker.add(
103 this.scalingTicketItem_, 104 this.scalingTicketItem_,
104 print_preview.ticket_items.TicketItem.EventType.CHANGE, 105 print_preview.ticket_items.TicketItem.EventType.CHANGE,
105 this.updateState_.bind(this)); 106 this.updateState_.bind(this));
106 this.tracker.add( 107 this.tracker.add(
107 this.fitToPageTicketItem_, 108 this.fitToPageTicketItem_,
108 print_preview.ticket_items.TicketItem.EventType.CHANGE, 109 print_preview.ticket_items.TicketItem.EventType.CHANGE,
109 this.onFitToPageChange_.bind(this)); 110 this.onFitToPageChange_.bind(this));
110 }, 111 },
111 112
112 /** 113 /**
113 * @return {boolean} true if fit to page is available and selected. 114 * @return {boolean} true if fit to page is available and selected.
114 * @private 115 * @private
115 */ 116 */
116 isFitToPageSelected: function() { 117 isFitToPageSelected: function() {
117 return this.fitToPageTicketItem_.isCapabilityAvailable() && 118 return this.fitToPageTicketItem_.isCapabilityAvailable() &&
118 this.fitToPageTicketItem_.getValue(); 119 !!this.fitToPageTicketItem_.getValue();
119 }, 120 },
120 121
121 /** 122 /**
122 * @return {number} The current input field value as an integer. 123 * @return {number} The current input field value as an integer.
123 * @private 124 * @private
124 */ 125 */
125 getInputAsNumber: function() { 126 getInputAsNumber: function() {
126 return this.inputField_.valueAsNumber; 127 return this.inputField_.valueAsNumber;
127 }, 128 },
128 129
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 278 }
278 }, 279 },
279 280
280 }; 281 };
281 282
282 // Export 283 // Export
283 return { 284 return {
284 ScalingSettings: ScalingSettings 285 ScalingSettings: ScalingSettings
285 }; 286 };
286 }); 287 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698