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

Side by Side Diff: chrome/browser/resources/print_preview/data/print_ticket_store.js

Issue 1125343004: Add a "Simplify Page" option to the print preview dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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) 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 // TODO(rltoscano): Maybe clear print ticket when destination changes. Or 8 // TODO(rltoscano): Maybe clear print ticket when destination changes. Or
9 // better yet, carry over any print ticket state that is possible. I.e. if 9 // better yet, carry over any print ticket state that is possible. I.e. if
10 // destination changes, the new destination might not support duplex anymore, 10 // destination changes, the new destination might not support duplex anymore,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 /** 179 /**
180 * Print selection only ticket item. 180 * Print selection only ticket item.
181 * @type {!print_preview.ticket_items.SelectionOnly} 181 * @type {!print_preview.ticket_items.SelectionOnly}
182 * @private 182 * @private
183 */ 183 */
184 this.selectionOnly_ = 184 this.selectionOnly_ =
185 new print_preview.ticket_items.SelectionOnly(this.documentInfo_); 185 new print_preview.ticket_items.SelectionOnly(this.documentInfo_);
186 186
187 /** 187 /**
188 * Print friendly ticket item.
189 * @type {!print_preview.ticket_items.PrintFriendly}
190 * @private
191 */
192 this.printFriendly_ = new print_preview.ticket_items.PrintFriendly(
193 this.appState_,
194 this.documentInfo_,
195 this.selectionOnly_);
196
197 /**
188 * Vendor ticket items. 198 * Vendor ticket items.
189 * @type {!print_preview.ticket_items.VendorItems} 199 * @type {!print_preview.ticket_items.VendorItems}
190 * @private 200 * @private
191 */ 201 */
192 this.vendorItems_ = new print_preview.ticket_items.VendorItems( 202 this.vendorItems_ = new print_preview.ticket_items.VendorItems(
193 this.appState_, this.destinationStore_); 203 this.appState_, this.destinationStore_);
194 204
195 /** 205 /**
196 * Keeps track of event listeners for the print ticket store. 206 * Keeps track of event listeners for the print ticket store.
197 * @type {!EventTracker} 207 * @type {!EventTracker}
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 }, 270 },
261 271
262 get fitToPage() { 272 get fitToPage() {
263 return this.fitToPage_; 273 return this.fitToPage_;
264 }, 274 },
265 275
266 get headerFooter() { 276 get headerFooter() {
267 return this.headerFooter_; 277 return this.headerFooter_;
268 }, 278 },
269 279
280 get printFriendly() {
281 return this.printFriendly_;
282 },
283
270 get mediaSize() { 284 get mediaSize() {
271 return this.mediaSize_; 285 return this.mediaSize_;
272 }, 286 },
273 287
274 get landscape() { 288 get landscape() {
275 return this.landscape_; 289 return this.landscape_;
276 }, 290 },
277 291
278 get marginsType() { 292 get marginsType() {
279 return this.marginsType_; 293 return this.marginsType_;
(...skipping 20 matching lines...) Expand all
300 }, 314 },
301 315
302 /** 316 /**
303 * Initializes the print ticket store. Dispatches an INITIALIZE event. 317 * Initializes the print ticket store. Dispatches an INITIALIZE event.
304 * @param {string} thousandsDelimeter Delimeter of the thousands place. 318 * @param {string} thousandsDelimeter Delimeter of the thousands place.
305 * @param {string} decimalDelimeter Delimeter of the decimal point. 319 * @param {string} decimalDelimeter Delimeter of the decimal point.
306 * @param {!print_preview.MeasurementSystem.UnitType} unitType Type of unit 320 * @param {!print_preview.MeasurementSystem.UnitType} unitType Type of unit
307 * of the local measurement system. 321 * of the local measurement system.
308 * @param {boolean} selectionOnly Whether only selected content should be 322 * @param {boolean} selectionOnly Whether only selected content should be
309 * printed. 323 * printed.
324 * @param {boolean} printFriendlyEnabled Whether print friendly is enabled.
310 */ 325 */
311 init: function( 326 init: function(
312 thousandsDelimeter, decimalDelimeter, unitType, selectionOnly) { 327 thousandsDelimeter, decimalDelimeter, unitType,
328 selectionOnly, printFriendlyEnabled) {
313 this.measurementSystem_.setSystem(thousandsDelimeter, decimalDelimeter, 329 this.measurementSystem_.setSystem(thousandsDelimeter, decimalDelimeter,
314 unitType); 330 unitType);
315 this.selectionOnly_.updateValue(selectionOnly); 331 this.selectionOnly_.updateValue(selectionOnly);
332 this.printFriendly_.setIsCapabilityAvailable(printFriendlyEnabled);
316 333
317 // Initialize ticket with user's previous values. 334 // Initialize ticket with user's previous values.
318 if (this.appState_.hasField( 335 if (this.appState_.hasField(
319 print_preview.AppState.Field.IS_COLOR_ENABLED)) { 336 print_preview.AppState.Field.IS_COLOR_ENABLED)) {
320 this.color_.updateValue( 337 this.color_.updateValue(
321 /** @type {!Object} */(this.appState_.getField( 338 /** @type {!Object} */(this.appState_.getField(
322 print_preview.AppState.Field.IS_COLOR_ENABLED))); 339 print_preview.AppState.Field.IS_COLOR_ENABLED)));
323 } 340 }
324 if (this.appState_.hasField(print_preview.AppState.Field.DPI)) { 341 if (this.appState_.hasField(print_preview.AppState.Field.DPI)) {
325 this.dpi_.updateValue( 342 this.dpi_.updateValue(
(...skipping 29 matching lines...) Expand all
355 /** @type {!Object} */(this.appState_.getField( 372 /** @type {!Object} */(this.appState_.getField(
356 print_preview.AppState.Field.CUSTOM_MARGINS))); 373 print_preview.AppState.Field.CUSTOM_MARGINS)));
357 } 374 }
358 if (this.appState_.hasField( 375 if (this.appState_.hasField(
359 print_preview.AppState.Field.IS_HEADER_FOOTER_ENABLED)) { 376 print_preview.AppState.Field.IS_HEADER_FOOTER_ENABLED)) {
360 this.headerFooter_.updateValue( 377 this.headerFooter_.updateValue(
361 /** @type {!Object} */(this.appState_.getField( 378 /** @type {!Object} */(this.appState_.getField(
362 print_preview.AppState.Field.IS_HEADER_FOOTER_ENABLED))); 379 print_preview.AppState.Field.IS_HEADER_FOOTER_ENABLED)));
363 } 380 }
364 if (this.appState_.hasField( 381 if (this.appState_.hasField(
382 print_preview.AppState.Field.IS_PRINT_FRIENDLY_ENABLED)) {
383 this.printFriendly.updateValue(
384 /** @type {!Object} */(this.appState_.getField(
385 print_preview.AppState.Field.IS_PRINT_FRIENDLY_ENABLED)));
386 }
387 if (this.appState_.hasField(
365 print_preview.AppState.Field.IS_COLLATE_ENABLED)) { 388 print_preview.AppState.Field.IS_COLLATE_ENABLED)) {
366 this.collate_.updateValue( 389 this.collate_.updateValue(
367 /** @type {!Object} */(this.appState_.getField( 390 /** @type {!Object} */(this.appState_.getField(
368 print_preview.AppState.Field.IS_COLLATE_ENABLED))); 391 print_preview.AppState.Field.IS_COLLATE_ENABLED)));
369 } 392 }
370 if (this.appState_.hasField( 393 if (this.appState_.hasField(
371 print_preview.AppState.Field.IS_CSS_BACKGROUND_ENABLED)) { 394 print_preview.AppState.Field.IS_CSS_BACKGROUND_ENABLED)) {
372 this.cssBackground_.updateValue( 395 this.cssBackground_.updateValue(
373 /** @type {!Object} */(this.appState_.getField( 396 /** @type {!Object} */(this.appState_.getField(
374 print_preview.AppState.Field.IS_CSS_BACKGROUND_ENABLED))); 397 print_preview.AppState.Field.IS_CSS_BACKGROUND_ENABLED)));
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 onDocumentInfoChange_: function() { 578 onDocumentInfoChange_: function() {
556 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); 579 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE);
557 }, 580 },
558 }; 581 };
559 582
560 // Export 583 // Export
561 return { 584 return {
562 PrintTicketStore: PrintTicketStore 585 PrintTicketStore: PrintTicketStore
563 }; 586 };
564 }); 587 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698