OLD | NEW |
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 Loading... |
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.documentInfo_, |
| 194 this.selectionOnly_); |
| 195 |
| 196 /** |
188 * Vendor ticket items. | 197 * Vendor ticket items. |
189 * @type {!print_preview.ticket_items.VendorItems} | 198 * @type {!print_preview.ticket_items.VendorItems} |
190 * @private | 199 * @private |
191 */ | 200 */ |
192 this.vendorItems_ = new print_preview.ticket_items.VendorItems( | 201 this.vendorItems_ = new print_preview.ticket_items.VendorItems( |
193 this.appState_, this.destinationStore_); | 202 this.appState_, this.destinationStore_); |
194 | 203 |
195 /** | 204 /** |
196 * Keeps track of event listeners for the print ticket store. | 205 * Keeps track of event listeners for the print ticket store. |
197 * @type {!EventTracker} | 206 * @type {!EventTracker} |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 }, | 269 }, |
261 | 270 |
262 get fitToPage() { | 271 get fitToPage() { |
263 return this.fitToPage_; | 272 return this.fitToPage_; |
264 }, | 273 }, |
265 | 274 |
266 get headerFooter() { | 275 get headerFooter() { |
267 return this.headerFooter_; | 276 return this.headerFooter_; |
268 }, | 277 }, |
269 | 278 |
| 279 get printFriendly() { |
| 280 return this.printFriendly_; |
| 281 }, |
| 282 |
270 get mediaSize() { | 283 get mediaSize() { |
271 return this.mediaSize_; | 284 return this.mediaSize_; |
272 }, | 285 }, |
273 | 286 |
274 get landscape() { | 287 get landscape() { |
275 return this.landscape_; | 288 return this.landscape_; |
276 }, | 289 }, |
277 | 290 |
278 get marginsType() { | 291 get marginsType() { |
279 return this.marginsType_; | 292 return this.marginsType_; |
(...skipping 20 matching lines...) Expand all Loading... |
300 }, | 313 }, |
301 | 314 |
302 /** | 315 /** |
303 * Initializes the print ticket store. Dispatches an INITIALIZE event. | 316 * Initializes the print ticket store. Dispatches an INITIALIZE event. |
304 * @param {string} thousandsDelimeter Delimeter of the thousands place. | 317 * @param {string} thousandsDelimeter Delimeter of the thousands place. |
305 * @param {string} decimalDelimeter Delimeter of the decimal point. | 318 * @param {string} decimalDelimeter Delimeter of the decimal point. |
306 * @param {!print_preview.MeasurementSystem.UnitType} unitType Type of unit | 319 * @param {!print_preview.MeasurementSystem.UnitType} unitType Type of unit |
307 * of the local measurement system. | 320 * of the local measurement system. |
308 * @param {boolean} selectionOnly Whether only selected content should be | 321 * @param {boolean} selectionOnly Whether only selected content should be |
309 * printed. | 322 * printed. |
| 323 * @param {boolean} printFriendlyEnabled Whether print friendly is enabled. |
310 */ | 324 */ |
311 init: function( | 325 init: function( |
312 thousandsDelimeter, decimalDelimeter, unitType, selectionOnly) { | 326 thousandsDelimeter, decimalDelimeter, unitType, |
| 327 selectionOnly, printFriendlyEnabled) { |
313 this.measurementSystem_.setSystem(thousandsDelimeter, decimalDelimeter, | 328 this.measurementSystem_.setSystem(thousandsDelimeter, decimalDelimeter, |
314 unitType); | 329 unitType); |
315 this.selectionOnly_.updateValue(selectionOnly); | 330 this.selectionOnly_.updateValue(selectionOnly); |
| 331 this.printFriendly_.setIsCapabilityAvailable(printFriendlyEnabled); |
316 | 332 |
317 // Initialize ticket with user's previous values. | 333 // Initialize ticket with user's previous values. |
318 if (this.appState_.hasField( | 334 if (this.appState_.hasField( |
319 print_preview.AppState.Field.IS_COLOR_ENABLED)) { | 335 print_preview.AppState.Field.IS_COLOR_ENABLED)) { |
320 this.color_.updateValue( | 336 this.color_.updateValue( |
321 /** @type {!Object} */(this.appState_.getField( | 337 /** @type {!Object} */(this.appState_.getField( |
322 print_preview.AppState.Field.IS_COLOR_ENABLED))); | 338 print_preview.AppState.Field.IS_COLOR_ENABLED))); |
323 } | 339 } |
324 if (this.appState_.hasField(print_preview.AppState.Field.DPI)) { | 340 if (this.appState_.hasField(print_preview.AppState.Field.DPI)) { |
325 this.dpi_.updateValue( | 341 this.dpi_.updateValue( |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 onDocumentInfoChange_: function() { | 571 onDocumentInfoChange_: function() { |
556 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); | 572 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); |
557 }, | 573 }, |
558 }; | 574 }; |
559 | 575 |
560 // Export | 576 // Export |
561 return { | 577 return { |
562 PrintTicketStore: PrintTicketStore | 578 PrintTicketStore: PrintTicketStore |
563 }; | 579 }; |
564 }); | 580 }); |
OLD | NEW |