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

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

Issue 2108833002: Remove Simplify Page option from Print Preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mark histogram entries as unused Created 4 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
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.
11 * @param {!print_preview.ticket_items.FitToPage} fitToPage Fit-to-page ticket 11 * @param {!print_preview.ticket_items.FitToPage} fitToPage Fit-to-page ticket
12 * item. 12 * item.
13 * @param {!print_preview.ticket_items.CssBackground} cssBackground CSS 13 * @param {!print_preview.ticket_items.CssBackground} cssBackground CSS
14 * background ticket item. 14 * background ticket item.
15 * @param {!print_preview.ticket_items.SelectionOnly} selectionOnly Selection 15 * @param {!print_preview.ticket_items.SelectionOnly} selectionOnly Selection
16 * only ticket item. 16 * only ticket item.
17 * @param {!print_preview.ticket_items.HeaderFooter} headerFooter Header 17 * @param {!print_preview.ticket_items.HeaderFooter} headerFooter Header
18 * footer ticket item. 18 * footer ticket item.
19 * @param {!print_preview.ticket_items.DistillPage} distillPage Print
20 * distill page ticket item.
21 * @constructor 19 * @constructor
22 * @extends {print_preview.SettingsSection} 20 * @extends {print_preview.SettingsSection}
23 */ 21 */
24 function OtherOptionsSettings( 22 function OtherOptionsSettings(
25 duplex, fitToPage, cssBackground, selectionOnly, 23 duplex, fitToPage, cssBackground, selectionOnly, headerFooter) {
26 headerFooter, distillPage) {
27 print_preview.SettingsSection.call(this); 24 print_preview.SettingsSection.call(this);
28 25
29 /** 26 /**
30 * Duplex ticket item, used to read/write the duplex selection. 27 * Duplex ticket item, used to read/write the duplex selection.
31 * @type {!print_preview.ticket_items.Duplex} 28 * @type {!print_preview.ticket_items.Duplex}
32 * @private 29 * @private
33 */ 30 */
34 this.duplexTicketItem_ = duplex; 31 this.duplexTicketItem_ = duplex;
35 32
36 /** 33 /**
(...skipping 17 matching lines...) Expand all
54 */ 51 */
55 this.selectionOnlyTicketItem_ = selectionOnly; 52 this.selectionOnlyTicketItem_ = selectionOnly;
56 53
57 /** 54 /**
58 * Header-footer ticket item, used to read/write. 55 * Header-footer ticket item, used to read/write.
59 * @type {!print_preview.ticket_items.HeaderFooter} 56 * @type {!print_preview.ticket_items.HeaderFooter}
60 * @private 57 * @private
61 */ 58 */
62 this.headerFooterTicketItem_ = headerFooter; 59 this.headerFooterTicketItem_ = headerFooter;
63 60
64 /**
65 * Distill page ticket item, used to read/write.
66 * @type {!print_preview.ticket_items.DistillPage}
67 * @private
68 */
69 this.distillPageTicketItem_ = distillPage;
70
71 /**
72 * Distill page container element.
73 * @type {HTMLElement}
74 * @private
75 */
76 this.distillPageContainer_ = null;
77
78 /**
79 * Distill page checkbox.
80 * @type {HTMLInputElement}
81 * @private
82 */
83 this.distillPageCheckbox_ = null;
84
85 /** 61 /**
86 * Header footer container element. 62 * Header footer container element.
87 * @type {HTMLElement} 63 * @type {HTMLElement}
88 * @private 64 * @private
89 */ 65 */
90 this.headerFooterContainer_ = null; 66 this.headerFooterContainer_ = null;
91 67
92 /** 68 /**
93 * Header footer checkbox. 69 * Header footer checkbox.
94 * @type {HTMLInputElement} 70 * @type {HTMLInputElement}
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 * @private 127 * @private
152 */ 128 */
153 this.selectionOnlyCheckbox_ = null; 129 this.selectionOnlyCheckbox_ = null;
154 }; 130 };
155 131
156 OtherOptionsSettings.prototype = { 132 OtherOptionsSettings.prototype = {
157 __proto__: print_preview.SettingsSection.prototype, 133 __proto__: print_preview.SettingsSection.prototype,
158 134
159 /** @override */ 135 /** @override */
160 isAvailable: function() { 136 isAvailable: function() {
161 return this.distillPageTicketItem_.isCapabilityAvailable() || 137 return this.headerFooterTicketItem_.isCapabilityAvailable() ||
162 this.headerFooterTicketItem_.isCapabilityAvailable() ||
163 this.fitToPageTicketItem_.isCapabilityAvailable() || 138 this.fitToPageTicketItem_.isCapabilityAvailable() ||
164 this.duplexTicketItem_.isCapabilityAvailable() || 139 this.duplexTicketItem_.isCapabilityAvailable() ||
165 this.cssBackgroundTicketItem_.isCapabilityAvailable() || 140 this.cssBackgroundTicketItem_.isCapabilityAvailable() ||
166 this.selectionOnlyTicketItem_.isCapabilityAvailable(); 141 this.selectionOnlyTicketItem_.isCapabilityAvailable();
167 }, 142 },
168 143
169 /** @override */ 144 /** @override */
170 hasCollapsibleContent: function() { 145 hasCollapsibleContent: function() {
171 return this.headerFooterTicketItem_.isCapabilityAvailable() || 146 return this.headerFooterTicketItem_.isCapabilityAvailable() ||
172 this.cssBackgroundTicketItem_.isCapabilityAvailable() || 147 this.cssBackgroundTicketItem_.isCapabilityAvailable() ||
173 this.selectionOnlyTicketItem_.isCapabilityAvailable(); 148 this.selectionOnlyTicketItem_.isCapabilityAvailable();
174 }, 149 },
175 150
176 /** @override */ 151 /** @override */
177 set isEnabled(isEnabled) { 152 set isEnabled(isEnabled) {
178 this.headerFooterCheckbox_.disabled = !isEnabled; 153 this.headerFooterCheckbox_.disabled = !isEnabled;
179 this.fitToPageCheckbox_.disabled = !isEnabled; 154 this.fitToPageCheckbox_.disabled = !isEnabled;
180 this.duplexCheckbox_.disabled = !isEnabled; 155 this.duplexCheckbox_.disabled = !isEnabled;
181 this.distillPageCheckbox_.disabled = !isEnabled;
182 this.cssBackgroundCheckbox_.disabled = !isEnabled; 156 this.cssBackgroundCheckbox_.disabled = !isEnabled;
183 }, 157 },
184 158
185 /** @override */ 159 /** @override */
186 enterDocument: function() { 160 enterDocument: function() {
187 print_preview.SettingsSection.prototype.enterDocument.call(this); 161 print_preview.SettingsSection.prototype.enterDocument.call(this);
188 this.tracker.add( 162 this.tracker.add(
189 this.distillPageCheckbox_,
190 'click',
191 this.onDistillPageCheckboxClick_.bind(this));
192 this.tracker.add(
193 this.headerFooterCheckbox_, 163 this.headerFooterCheckbox_,
194 'click', 164 'click',
195 this.onHeaderFooterCheckboxClick_.bind(this)); 165 this.onHeaderFooterCheckboxClick_.bind(this));
196 this.tracker.add( 166 this.tracker.add(
197 this.fitToPageCheckbox_, 167 this.fitToPageCheckbox_,
198 'click', 168 'click',
199 this.onFitToPageCheckboxClick_.bind(this)); 169 this.onFitToPageCheckboxClick_.bind(this));
200 this.tracker.add( 170 this.tracker.add(
201 this.duplexCheckbox_, 171 this.duplexCheckbox_,
202 'click', 172 'click',
(...skipping 19 matching lines...) Expand all
222 print_preview.ticket_items.TicketItem.EventType.CHANGE, 192 print_preview.ticket_items.TicketItem.EventType.CHANGE,
223 this.onCssBackgroundChange_.bind(this)); 193 this.onCssBackgroundChange_.bind(this));
224 this.tracker.add( 194 this.tracker.add(
225 this.selectionOnlyTicketItem_, 195 this.selectionOnlyTicketItem_,
226 print_preview.ticket_items.TicketItem.EventType.CHANGE, 196 print_preview.ticket_items.TicketItem.EventType.CHANGE,
227 this.onSelectionOnlyChange_.bind(this)); 197 this.onSelectionOnlyChange_.bind(this));
228 this.tracker.add( 198 this.tracker.add(
229 this.headerFooterTicketItem_, 199 this.headerFooterTicketItem_,
230 print_preview.ticket_items.TicketItem.EventType.CHANGE, 200 print_preview.ticket_items.TicketItem.EventType.CHANGE,
231 this.onHeaderFooterChange_.bind(this)); 201 this.onHeaderFooterChange_.bind(this));
232 this.tracker.add(
233 this.distillPageTicketItem_,
234 print_preview.ticket_items.TicketItem.EventType.CHANGE,
235 this.onDistillPageChange_.bind(this));
236 }, 202 },
237 203
238 /** @override */ 204 /** @override */
239 exitDocument: function() { 205 exitDocument: function() {
240 print_preview.SettingsSection.prototype.exitDocument.call(this); 206 print_preview.SettingsSection.prototype.exitDocument.call(this);
241 this.distillPageContainer_ = null;
242 this.distillPageCheckbox_ = null;
243 this.headerFooterContainer_ = null; 207 this.headerFooterContainer_ = null;
244 this.headerFooterCheckbox_ = null; 208 this.headerFooterCheckbox_ = null;
245 this.fitToPageContainer_ = null; 209 this.fitToPageContainer_ = null;
246 this.fitToPageCheckbox_ = null; 210 this.fitToPageCheckbox_ = null;
247 this.duplexContainer_ = null; 211 this.duplexContainer_ = null;
248 this.duplexCheckbox_ = null; 212 this.duplexCheckbox_ = null;
249 this.cssBackgroundContainer_ = null; 213 this.cssBackgroundContainer_ = null;
250 this.cssBackgroundCheckbox_ = null; 214 this.cssBackgroundCheckbox_ = null;
251 this.selectionOnlyContainer_ = null; 215 this.selectionOnlyContainer_ = null;
252 this.selectionOnlyCheckbox_ = null; 216 this.selectionOnlyCheckbox_ = null;
253 }, 217 },
254 218
255 /** @override */ 219 /** @override */
256 decorateInternal: function() { 220 decorateInternal: function() {
257 this.distillPageContainer_ = this.getElement().querySelector(
258 '.distill-page-container');
259 this.distillPageCheckbox_ = this.distillPageContainer_.querySelector(
260 '.distill-page-checkbox');
261 this.headerFooterContainer_ = this.getElement().querySelector( 221 this.headerFooterContainer_ = this.getElement().querySelector(
262 '.header-footer-container'); 222 '.header-footer-container');
263 this.headerFooterCheckbox_ = this.headerFooterContainer_.querySelector( 223 this.headerFooterCheckbox_ = this.headerFooterContainer_.querySelector(
264 '.header-footer-checkbox'); 224 '.header-footer-checkbox');
265 this.fitToPageContainer_ = this.getElement().querySelector( 225 this.fitToPageContainer_ = this.getElement().querySelector(
266 '.fit-to-page-container'); 226 '.fit-to-page-container');
267 this.fitToPageCheckbox_ = this.fitToPageContainer_.querySelector( 227 this.fitToPageCheckbox_ = this.fitToPageContainer_.querySelector(
268 '.fit-to-page-checkbox'); 228 '.fit-to-page-checkbox');
269 this.duplexContainer_ = this.getElement().querySelector( 229 this.duplexContainer_ = this.getElement().querySelector(
270 '.duplex-container'); 230 '.duplex-container');
271 this.duplexCheckbox_ = this.duplexContainer_.querySelector( 231 this.duplexCheckbox_ = this.duplexContainer_.querySelector(
272 '.duplex-checkbox'); 232 '.duplex-checkbox');
273 this.cssBackgroundContainer_ = this.getElement().querySelector( 233 this.cssBackgroundContainer_ = this.getElement().querySelector(
274 '.css-background-container'); 234 '.css-background-container');
275 this.cssBackgroundCheckbox_ = this.cssBackgroundContainer_.querySelector( 235 this.cssBackgroundCheckbox_ = this.cssBackgroundContainer_.querySelector(
276 '.css-background-checkbox'); 236 '.css-background-checkbox');
277 this.selectionOnlyContainer_ = this.getElement().querySelector( 237 this.selectionOnlyContainer_ = this.getElement().querySelector(
278 '.selection-only-container'); 238 '.selection-only-container');
279 this.selectionOnlyCheckbox_ = this.selectionOnlyContainer_.querySelector( 239 this.selectionOnlyCheckbox_ = this.selectionOnlyContainer_.querySelector(
280 '.selection-only-checkbox'); 240 '.selection-only-checkbox');
281 }, 241 },
282 242
283 /** @override */ 243 /** @override */
284 updateUiStateInternal: function() { 244 updateUiStateInternal: function() {
285 if (this.isAvailable()) { 245 if (this.isAvailable()) {
286 setIsVisible(this.distillPageContainer_,
287 this.distillPageTicketItem_.isCapabilityAvailable());
288 setIsVisible(this.headerFooterContainer_, 246 setIsVisible(this.headerFooterContainer_,
289 this.headerFooterTicketItem_.isCapabilityAvailable() && 247 this.headerFooterTicketItem_.isCapabilityAvailable() &&
290 !this.collapseContent); 248 !this.collapseContent);
291 setIsVisible(this.fitToPageContainer_, 249 setIsVisible(this.fitToPageContainer_,
292 this.fitToPageTicketItem_.isCapabilityAvailable()); 250 this.fitToPageTicketItem_.isCapabilityAvailable());
293 setIsVisible(this.duplexContainer_, 251 setIsVisible(this.duplexContainer_,
294 this.duplexTicketItem_.isCapabilityAvailable()); 252 this.duplexTicketItem_.isCapabilityAvailable());
295 setIsVisible(this.cssBackgroundContainer_, 253 setIsVisible(this.cssBackgroundContainer_,
296 this.cssBackgroundTicketItem_.isCapabilityAvailable() && 254 this.cssBackgroundTicketItem_.isCapabilityAvailable() &&
297 !this.collapseContent); 255 !this.collapseContent);
298 setIsVisible(this.selectionOnlyContainer_, 256 setIsVisible(this.selectionOnlyContainer_,
299 this.selectionOnlyTicketItem_.isCapabilityAvailable() && 257 this.selectionOnlyTicketItem_.isCapabilityAvailable() &&
300 !this.collapseContent); 258 !this.collapseContent);
301 } 259 }
302 print_preview.SettingsSection.prototype.updateUiStateInternal.call(this); 260 print_preview.SettingsSection.prototype.updateUiStateInternal.call(this);
303 }, 261 },
304 262
305 /** @override */ 263 /** @override */
306 isSectionVisibleInternal: function() { 264 isSectionVisibleInternal: function() {
307 if (this.collapseContent) { 265 if (this.collapseContent) {
308 return this.distillPageTicketItem_.isCapabilityAvailable() || 266 return this.fitToPageTicketItem_.isCapabilityAvailable() ||
309 this.fitToPageTicketItem_.isCapabilityAvailable() ||
310 this.duplexTicketItem_.isCapabilityAvailable(); 267 this.duplexTicketItem_.isCapabilityAvailable();
311 } 268 }
312 269
313 return this.isAvailable(); 270 return this.isAvailable();
314 }, 271 },
315 272
316 /**
317 * Called when the distill-page checkbox is clicked. Updates the print
318 * ticket.
319 * @private
320 */
321 onDistillPageCheckboxClick_: function() {
322 this.distillPageTicketItem_.updateValue(
323 this.distillPageCheckbox_.checked);
324 },
325
326 /** 273 /**
327 * Called when the header-footer checkbox is clicked. Updates the print 274 * Called when the header-footer checkbox is clicked. Updates the print
328 * ticket. 275 * ticket.
329 * @private 276 * @private
330 */ 277 */
331 onHeaderFooterCheckboxClick_: function() { 278 onHeaderFooterCheckboxClick_: function() {
332 this.headerFooterTicketItem_.updateValue( 279 this.headerFooterTicketItem_.updateValue(
333 this.headerFooterCheckbox_.checked); 280 this.headerFooterCheckbox_.checked);
334 }, 281 },
335 282
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 /** 362 /**
416 * Called when the header-footer ticket item has changed. Updates the 363 * Called when the header-footer ticket item has changed. Updates the
417 * header-footer checkbox. 364 * header-footer checkbox.
418 * @private 365 * @private
419 */ 366 */
420 onHeaderFooterChange_: function() { 367 onHeaderFooterChange_: function() {
421 this.headerFooterCheckbox_.checked = 368 this.headerFooterCheckbox_.checked =
422 this.headerFooterTicketItem_.getValue(); 369 this.headerFooterTicketItem_.getValue();
423 this.updateUiStateInternal(); 370 this.updateUiStateInternal();
424 }, 371 },
425
426 /**
427 * Called when the distill-page ticket item has changed. Updates the
428 * distill-page checkbox.
429 * @private
430 */
431 onDistillPageChange_: function() {
432 this.distillPageCheckbox_.checked =
433 this.distillPageTicketItem_.getValue();
434 this.updateUiStateInternal();
435 }
436 }; 372 };
437 373
438 // Export 374 // Export
439 return { 375 return {
440 OtherOptionsSettings: OtherOptionsSettings 376 OtherOptionsSettings: OtherOptionsSettings
441 }; 377 };
442 }); 378 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/settings/other_options_settings.html ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698