OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('print_preview.ticket_items', function() { |
| 6 'use strict'; |
| 7 |
| 8 /** |
| 9 * Fit-to-page ticket item whose value is a {@code boolean} that indicates |
| 10 * whether to scale the document to fit the page. |
| 11 * @param {!print_preview.DocumentInfo} documentInfo Information about the |
| 12 * document to print. |
| 13 * @param {!print_preview.DestinationStore} destinationStore Used to determine |
| 14 * whether fit to page should be available. |
| 15 * @constructor |
| 16 * @extends {print_preview.ticket_items.TicketItem} |
| 17 */ |
| 18 function FitToPage(documentInfo, destinationStore) { |
| 19 print_preview.ticket_items.TicketItem.call(this); |
| 20 |
| 21 /** |
| 22 * Information about the document to print. |
| 23 * @type {!print_preview.DocumentInfo} |
| 24 * @private |
| 25 */ |
| 26 this.documentInfo_ = documentInfo; |
| 27 |
| 28 /** |
| 29 * Used to determine whether fit to page should be available. |
| 30 * @type {!print_preview.DestinationStore} |
| 31 * @private |
| 32 */ |
| 33 this.destinationStore_ = destinationStore; |
| 34 }; |
| 35 |
| 36 FitToPage.prototype = { |
| 37 __proto__: print_preview.ticket_items.TicketItem.prototype, |
| 38 |
| 39 /** @override */ |
| 40 wouldValueBeValid: function(value) { |
| 41 return true; |
| 42 }, |
| 43 |
| 44 /** @override */ |
| 45 isCapabilityAvailable: function() { |
| 46 return !this.documentInfo_.isModifiable && |
| 47 (!this.destinationStore_.selectedDestination || |
| 48 this.destinationStore_.selectedDestination.id != |
| 49 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF); |
| 50 }, |
| 51 |
| 52 /** @override */ |
| 53 getDefaultValueInternal: function() { |
| 54 return true; |
| 55 }, |
| 56 |
| 57 /** @override */ |
| 58 getCapabilityNotAvailableValueInternal: function() { |
| 59 return this.destinationStore_.selectedDestination && |
| 60 this.destinationStore_.selectedDestination.id == |
| 61 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF; |
| 62 } |
| 63 }; |
| 64 |
| 65 // Export |
| 66 return { |
| 67 FitToPage: FitToPage |
| 68 }; |
| 69 }); |
OLD | NEW |