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

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

Issue 595153003: Compile print_preview, part 5: reduce down to 104 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@I_print_preview_4
Patch Set: revert movement of enums: now handle in compiler pass Created 6 years, 2 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 * UI component that renders checkboxes for various print options. 9 * UI component that renders checkboxes for various print options.
10 * @param {!print_preview.ticket_items.Duplex} duplex Duplex ticket item. 10 * @param {!print_preview.ticket_items.Duplex} duplex Duplex ticket item.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 this.headerFooterCheckbox_.disabled = !isEnabled; 154 this.headerFooterCheckbox_.disabled = !isEnabled;
155 this.fitToPageCheckbox_.disabled = !isEnabled; 155 this.fitToPageCheckbox_.disabled = !isEnabled;
156 this.duplexCheckbox_.disabled = !isEnabled; 156 this.duplexCheckbox_.disabled = !isEnabled;
157 this.cssBackgroundCheckbox_.disabled = !isEnabled; 157 this.cssBackgroundCheckbox_.disabled = !isEnabled;
158 }, 158 },
159 159
160 /** @override */ 160 /** @override */
161 enterDocument: function() { 161 enterDocument: function() {
162 print_preview.SettingsSection.prototype.enterDocument.call(this); 162 print_preview.SettingsSection.prototype.enterDocument.call(this);
163 this.tracker.add( 163 this.tracker.add(
164 this.headerFooterCheckbox_, 164 assert(this.headerFooterCheckbox_),
165 'click', 165 'click',
166 this.onHeaderFooterCheckboxClick_.bind(this)); 166 this.onHeaderFooterCheckboxClick_.bind(this));
167 this.tracker.add( 167 this.tracker.add(
168 this.fitToPageCheckbox_, 168 assert(this.fitToPageCheckbox_),
169 'click', 169 'click',
170 this.onFitToPageCheckboxClick_.bind(this)); 170 this.onFitToPageCheckboxClick_.bind(this));
171 this.tracker.add( 171 this.tracker.add(
172 this.duplexCheckbox_, 172 assert(this.duplexCheckbox_),
173 'click', 173 'click',
174 this.onDuplexCheckboxClick_.bind(this)); 174 this.onDuplexCheckboxClick_.bind(this));
175 this.tracker.add( 175 this.tracker.add(
176 this.cssBackgroundCheckbox_, 176 assert(this.cssBackgroundCheckbox_),
177 'click', 177 'click',
178 this.onCssBackgroundCheckboxClick_.bind(this)); 178 this.onCssBackgroundCheckboxClick_.bind(this));
179 this.tracker.add( 179 this.tracker.add(
180 this.selectionOnlyCheckbox_, 180 assert(this.selectionOnlyCheckbox_),
181 'click', 181 'click',
182 this.onSelectionOnlyCheckboxClick_.bind(this)); 182 this.onSelectionOnlyCheckboxClick_.bind(this));
183 this.tracker.add( 183 this.tracker.add(
184 this.duplexTicketItem_, 184 assert(this.duplexTicketItem_),
185 print_preview.ticket_items.TicketItem.EventType.CHANGE, 185 print_preview.ticket_items.TicketItem.EventType.CHANGE,
186 this.onDuplexChange_.bind(this)); 186 this.onDuplexChange_.bind(this));
187 this.tracker.add( 187 this.tracker.add(
188 this.fitToPageTicketItem_, 188 assert(this.fitToPageTicketItem_),
189 print_preview.ticket_items.TicketItem.EventType.CHANGE, 189 print_preview.ticket_items.TicketItem.EventType.CHANGE,
190 this.onFitToPageChange_.bind(this)); 190 this.onFitToPageChange_.bind(this));
191 this.tracker.add( 191 this.tracker.add(
192 this.cssBackgroundTicketItem_, 192 assert(this.cssBackgroundTicketItem_),
193 print_preview.ticket_items.TicketItem.EventType.CHANGE, 193 print_preview.ticket_items.TicketItem.EventType.CHANGE,
194 this.onCssBackgroundChange_.bind(this)); 194 this.onCssBackgroundChange_.bind(this));
195 this.tracker.add( 195 this.tracker.add(
196 this.selectionOnlyTicketItem_, 196 assert(this.selectionOnlyTicketItem_),
197 print_preview.ticket_items.TicketItem.EventType.CHANGE, 197 print_preview.ticket_items.TicketItem.EventType.CHANGE,
198 this.onSelectionOnlyChange_.bind(this)); 198 this.onSelectionOnlyChange_.bind(this));
199 this.tracker.add( 199 this.tracker.add(
200 this.headerFooterTicketItem_, 200 assert(this.headerFooterTicketItem_),
201 print_preview.ticket_items.TicketItem.EventType.CHANGE, 201 print_preview.ticket_items.TicketItem.EventType.CHANGE,
202 this.onHeaderFooterChange_.bind(this)); 202 this.onHeaderFooterChange_.bind(this));
203 }, 203 },
204 204
205 /** @override */ 205 /** @override */
206 exitDocument: function() { 206 exitDocument: function() {
207 print_preview.SettingsSection.prototype.exitDocument.call(this); 207 print_preview.SettingsSection.prototype.exitDocument.call(this);
208 this.headerFooterContainer_ = null; 208 this.headerFooterContainer_ = null;
209 this.headerFooterCheckbox_ = null; 209 this.headerFooterCheckbox_ = null;
210 this.fitToPageContainer_ = null; 210 this.fitToPageContainer_ = null;
(...skipping 26 matching lines...) Expand all
237 '.css-background-checkbox'); 237 '.css-background-checkbox');
238 this.selectionOnlyContainer_ = this.getElement().querySelector( 238 this.selectionOnlyContainer_ = this.getElement().querySelector(
239 '.selection-only-container'); 239 '.selection-only-container');
240 this.selectionOnlyCheckbox_ = this.selectionOnlyContainer_.querySelector( 240 this.selectionOnlyCheckbox_ = this.selectionOnlyContainer_.querySelector(
241 '.selection-only-checkbox'); 241 '.selection-only-checkbox');
242 }, 242 },
243 243
244 /** @override */ 244 /** @override */
245 updateUiStateInternal: function() { 245 updateUiStateInternal: function() {
246 if (this.isAvailable()) { 246 if (this.isAvailable()) {
247 setIsVisible(this.headerFooterContainer_, 247 setIsVisible(assert(this.headerFooterContainer_),
248 this.headerFooterTicketItem_.isCapabilityAvailable() && 248 this.headerFooterTicketItem_.isCapabilityAvailable() &&
249 !this.collapseContent); 249 !this.collapseContent);
250 setIsVisible(this.fitToPageContainer_, 250 setIsVisible(assert(this.fitToPageContainer_),
251 this.fitToPageTicketItem_.isCapabilityAvailable() && 251 this.fitToPageTicketItem_.isCapabilityAvailable() &&
252 !this.collapseContent); 252 !this.collapseContent);
253 setIsVisible(this.duplexContainer_, 253 setIsVisible(assert(this.duplexContainer_),
254 this.duplexTicketItem_.isCapabilityAvailable()); 254 this.duplexTicketItem_.isCapabilityAvailable());
255 setIsVisible(this.cssBackgroundContainer_, 255 setIsVisible(assert(this.cssBackgroundContainer_),
256 this.cssBackgroundTicketItem_.isCapabilityAvailable() && 256 this.cssBackgroundTicketItem_.isCapabilityAvailable() &&
257 !this.collapseContent); 257 !this.collapseContent);
258 setIsVisible(this.selectionOnlyContainer_, 258 setIsVisible(assert(this.selectionOnlyContainer_),
259 this.selectionOnlyTicketItem_.isCapabilityAvailable() && 259 this.selectionOnlyTicketItem_.isCapabilityAvailable() &&
260 !this.collapseContent); 260 !this.collapseContent);
261 } 261 }
262 print_preview.SettingsSection.prototype.updateUiStateInternal.call(this); 262 print_preview.SettingsSection.prototype.updateUiStateInternal.call(this);
263 }, 263 },
264 264
265 /** @override */ 265 /** @override */
266 isSectionVisibleInternal: function() { 266 isSectionVisibleInternal: function() {
267 return this.collapseContent ? 267 return this.collapseContent ?
268 this.duplexTicketItem_.isCapabilityAvailable() : this.isAvailable(); 268 this.duplexTicketItem_.isCapabilityAvailable() : this.isAvailable();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 this.selectionOnlyTicketItem_.updateValue( 314 this.selectionOnlyTicketItem_.updateValue(
315 this.selectionOnlyCheckbox_.checked); 315 this.selectionOnlyCheckbox_.checked);
316 }, 316 },
317 317
318 /** 318 /**
319 * Called when the duplex ticket item has changed. Updates the duplex 319 * Called when the duplex ticket item has changed. Updates the duplex
320 * checkbox. 320 * checkbox.
321 * @private 321 * @private
322 */ 322 */
323 onDuplexChange_: function() { 323 onDuplexChange_: function() {
324 this.duplexCheckbox_.checked = this.duplexTicketItem_.getValue(); 324 this.duplexCheckbox_.checked = !!this.duplexTicketItem_.getValue();
325 this.updateUiStateInternal(); 325 this.updateUiStateInternal();
326 }, 326 },
327 327
328 /** 328 /**
329 * Called when the fit-to-page ticket item has changed. Updates the 329 * Called when the fit-to-page ticket item has changed. Updates the
330 * fit-to-page checkbox. 330 * fit-to-page checkbox.
331 * @private 331 * @private
332 */ 332 */
333 onFitToPageChange_: function() { 333 onFitToPageChange_: function() {
334 this.fitToPageCheckbox_.checked = this.fitToPageTicketItem_.getValue(); 334 this.fitToPageCheckbox_.checked = !!this.fitToPageTicketItem_.getValue();
335 this.updateUiStateInternal(); 335 this.updateUiStateInternal();
336 }, 336 },
337 337
338 /** 338 /**
339 * Called when the CSS background ticket item has changed. Updates the 339 * Called when the CSS background ticket item has changed. Updates the
340 * CSS background checkbox. 340 * CSS background checkbox.
341 * @private 341 * @private
342 */ 342 */
343 onCssBackgroundChange_: function() { 343 onCssBackgroundChange_: function() {
344 this.cssBackgroundCheckbox_.checked = 344 this.cssBackgroundCheckbox_.checked =
345 this.cssBackgroundTicketItem_.getValue(); 345 !!this.cssBackgroundTicketItem_.getValue();
346 this.updateUiStateInternal(); 346 this.updateUiStateInternal();
347 }, 347 },
348 348
349 /** 349 /**
350 * Called when the print selection only ticket item has changed. Updates the 350 * Called when the print selection only ticket item has changed. Updates the
351 * CSS background checkbox. 351 * CSS background checkbox.
352 * @private 352 * @private
353 */ 353 */
354 onSelectionOnlyChange_: function() { 354 onSelectionOnlyChange_: function() {
355 this.selectionOnlyCheckbox_.checked = 355 this.selectionOnlyCheckbox_.checked =
356 this.selectionOnlyTicketItem_.getValue(); 356 !!this.selectionOnlyTicketItem_.getValue();
357 this.updateUiStateInternal(); 357 this.updateUiStateInternal();
358 }, 358 },
359 359
360 /** 360 /**
361 * Called when the header-footer ticket item has changed. Updates the 361 * Called when the header-footer ticket item has changed. Updates the
362 * header-footer checkbox. 362 * header-footer checkbox.
363 * @private 363 * @private
364 */ 364 */
365 onHeaderFooterChange_: function() { 365 onHeaderFooterChange_: function() {
366 this.headerFooterCheckbox_.checked = 366 this.headerFooterCheckbox_.checked =
367 this.headerFooterTicketItem_.getValue(); 367 !!this.headerFooterTicketItem_.getValue();
368 this.updateUiStateInternal(); 368 this.updateUiStateInternal();
369 } 369 }
370 }; 370 };
371 371
372 // Export 372 // Export
373 return { 373 return {
374 OtherOptionsSettings: OtherOptionsSettings 374 OtherOptionsSettings: OtherOptionsSettings
375 }; 375 };
376 }); 376 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698