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.ticket_items', function() { | 5 cr.define('print_preview.ticket_items', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Fit-to-page ticket item whose value is a {@code boolean} that indicates | 9 * Fit-to-page ticket item whose value is a {@code boolean} that indicates |
10 * whether to scale the document to fit the page. | 10 * whether to scale the document to fit the page. |
11 * @param {!print_preview.AppState} appState App state to persist item value. | 11 * @param {!print_preview.AppState} appState App state to persist item value. |
12 * @param {!print_preview.DocumentInfo} documentInfo Information about the | 12 * @param {!print_preview.DocumentInfo} documentInfo Information about the |
13 * document to print. | 13 * document to print. |
14 * @param {!print_preview.DestinationStore} destinationStore Used to determine | 14 * @param {!print_preview.DestinationStore} destinationStore Used to determine |
15 * whether fit to page should be available. | 15 * whether fit to page should be available. |
16 * @constructor | 16 * @constructor |
17 * @extends {print_preview.ticket_items.TicketItem} | 17 * @extends {print_preview.ticket_items.TicketItem} |
18 */ | 18 */ |
19 function FitToPage(appState, documentInfo, destinationStore) { | 19 function FitToPage(appState, documentInfo, destinationStore) { |
20 print_preview.ticket_items.TicketItem.call( | 20 print_preview.ticket_items.TicketItem.call( |
21 this, | 21 this, appState, print_preview.AppStateField.IS_FIT_TO_PAGE_ENABLED, |
22 appState, | 22 destinationStore, documentInfo); |
23 print_preview.AppStateField.IS_FIT_TO_PAGE_ENABLED, | |
24 destinationStore, | |
25 documentInfo); | |
26 } | 23 } |
27 | 24 |
28 FitToPage.prototype = { | 25 FitToPage.prototype = { |
29 __proto__: print_preview.ticket_items.TicketItem.prototype, | 26 __proto__: print_preview.ticket_items.TicketItem.prototype, |
30 | 27 |
31 /** @override */ | 28 /** @override */ |
32 wouldValueBeValid: function(value) { | 29 wouldValueBeValid: function(value) { |
33 return true; | 30 return true; |
34 }, | 31 }, |
35 | 32 |
36 /** @override */ | 33 /** @override */ |
37 isCapabilityAvailable: function() { | 34 isCapabilityAvailable: function() { |
38 return !this.getDocumentInfoInternal().isModifiable && | 35 return !this.getDocumentInfoInternal().isModifiable && |
39 (!this.getSelectedDestInternal() || | 36 (!this.getSelectedDestInternal() || |
40 this.getSelectedDestInternal().id != | 37 this.getSelectedDestInternal().id != |
41 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF); | 38 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF); |
42 }, | 39 }, |
43 | 40 |
44 /** @override */ | 41 /** @override */ |
45 getDefaultValueInternal: function() { | 42 getDefaultValueInternal: function() { |
46 // It's on by default since it is not a document feature, it is rather | 43 // It's on by default since it is not a document feature, it is rather |
47 // a property of the printer, hardware margins limitations. User can | 44 // a property of the printer, hardware margins limitations. User can |
48 // always override it. | 45 // always override it. |
49 return true; | 46 return true; |
50 }, | 47 }, |
51 | 48 |
52 /** @override */ | 49 /** @override */ |
53 getCapabilityNotAvailableValueInternal: function() { | 50 getCapabilityNotAvailableValueInternal: function() { |
54 return !this.getSelectedDestInternal() || | 51 return !this.getSelectedDestInternal() || |
55 this.getSelectedDestInternal().id != | 52 this.getSelectedDestInternal().id != |
56 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF; | 53 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF; |
57 } | 54 } |
58 }; | 55 }; |
59 | 56 |
60 // Export | 57 // Export |
61 return { | 58 return {FitToPage: FitToPage}; |
62 FitToPage: FitToPage | |
63 }; | |
64 }); | 59 }); |
OLD | NEW |