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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 if (this.mediaSize.isCapabilityAvailable()) { | 414 if (this.mediaSize.isCapabilityAvailable()) { |
415 var value = this.mediaSize.getValue(); | 415 var value = this.mediaSize.getValue(); |
416 cjt.print.media_size = { | 416 cjt.print.media_size = { |
417 width_microns: value.width_microns, | 417 width_microns: value.width_microns, |
418 height_microns: value.height_microns, | 418 height_microns: value.height_microns, |
419 is_continuous_feed: value.is_continuous_feed, | 419 is_continuous_feed: value.is_continuous_feed, |
420 vendor_id: value.vendor_id | 420 vendor_id: value.vendor_id |
421 }; | 421 }; |
422 } | 422 } |
423 if (this.landscape.isCapabilityAvailable() && | 423 if (!this.landscape.isCapabilityAvailable()) { |
424 this.landscape.isUserEdited()) { | 424 // In this case "orientation" option is hidden from user, so user can't |
| 425 // adjust it for page content, see Landscape.isCapabilityAvailable(). |
| 426 // We can improve results if we set AUTO here. |
| 427 if (this.landscape.hasOption('AUTO')) |
| 428 cjt.print.page_orientation = { type: 'AUTO' }; |
| 429 } else if (this.landscape.isUserEdited()) { |
425 cjt.print.page_orientation = | 430 cjt.print.page_orientation = |
426 {type: this.landscape.getValue() ? 'LANDSCAPE' : 'PORTRAIT'}; | 431 {type: this.landscape.getValue() ? 'LANDSCAPE' : 'PORTRAIT'}; |
427 } | 432 } |
428 if (this.vendorItems.isCapabilityAvailable() && | 433 if (this.vendorItems.isCapabilityAvailable() && |
429 this.vendorItems.isUserEdited()) { | 434 this.vendorItems.isUserEdited()) { |
430 var items = this.vendorItems.ticketItems; | 435 var items = this.vendorItems.ticketItems; |
431 cjt.print.vendor_ticket_item = []; | 436 cjt.print.vendor_ticket_item = []; |
432 for (var itemId in items) { | 437 for (var itemId in items) { |
433 if (items.hasOwnProperty(itemId)) { | 438 if (items.hasOwnProperty(itemId)) { |
434 cjt.print.vendor_ticket_item.push( | 439 cjt.print.vendor_ticket_item.push( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 onDocumentInfoChange_: function() { | 518 onDocumentInfoChange_: function() { |
514 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); | 519 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); |
515 }, | 520 }, |
516 }; | 521 }; |
517 | 522 |
518 // Export | 523 // Export |
519 return { | 524 return { |
520 PrintTicketStore: PrintTicketStore | 525 PrintTicketStore: PrintTicketStore |
521 }; | 526 }; |
522 }); | 527 }); |
OLD | NEW |