OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 * Ticket item whose value is a {@code boolean} that represents whether to | 9 * Ticket item whose value is a {@code boolean} that represents whether to |
10 * print selection only. | 10 * simplify the page before printing. |
11 * @param {!print_preview.DocumentInfo} documentInfo Information about the | 11 * @param {!print_preview.DocumentInfo} documentInfo Information about the |
12 * document to print. | 12 * document to print. |
Aleksey Shlyapnikov
2015/07/01 23:23:51
Add selectionOnly param description.
| |
13 * @constructor | 13 * @constructor |
14 * @extends {print_preview.ticket_items.TicketItem} | 14 * @extends {print_preview.ticket_items.TicketItem} |
15 */ | 15 */ |
16 function SelectionOnly(documentInfo) { | 16 function PrintFriendly(documentInfo, selectionOnly) { |
17 print_preview.ticket_items.TicketItem.call( | 17 print_preview.ticket_items.TicketItem.call( |
18 this, | 18 this, |
19 null /*appState*/, | 19 null /*appState*/, |
20 null /*field*/, | 20 null /*field*/, |
21 null /*destinationStore*/, | 21 null /*destinationStore*/, |
22 documentInfo); | 22 documentInfo); |
23 | |
24 this.isAvailable_ = false; | |
25 | |
26 this.selectionOnly_ = selectionOnly; | |
23 }; | 27 }; |
24 | 28 |
25 SelectionOnly.prototype = { | 29 PrintFriendly.prototype = { |
26 __proto__: print_preview.ticket_items.TicketItem.prototype, | 30 __proto__: print_preview.ticket_items.TicketItem.prototype, |
27 | 31 |
28 /** @override */ | 32 /** @override */ |
29 wouldValueBeValid: function(value) { | 33 wouldValueBeValid: function(value) { |
30 return true; | 34 return true; |
31 }, | 35 }, |
32 | 36 |
33 /** @override */ | 37 /** @override */ |
34 isCapabilityAvailable: function() { | 38 isCapabilityAvailable: function() { |
35 return this.getDocumentInfoInternal().isModifiable && | 39 return this.isAvailable_ && !this.selectionOnly_.getValue(); |
Aleksey Shlyapnikov
2015/07/01 23:23:51
So if user unchecks "selection only" this checkbox
| |
36 this.getDocumentInfoInternal().hasSelection; | |
37 }, | 40 }, |
38 | 41 |
39 /** @override */ | 42 /** @override */ |
40 getDefaultValueInternal: function() { | 43 getDefaultValueInternal: function() { |
41 return false; | 44 return false; |
42 }, | 45 }, |
43 | 46 |
44 /** @override */ | 47 /** @override */ |
45 getCapabilityNotAvailableValueInternal: function() { | 48 getCapabilityNotAvailableValueInternal: function() { |
46 return false; | 49 return false; |
50 }, | |
51 | |
52 setIsCapabilityAvailable: function(isAvailable) { | |
53 this.isAvailable_ = isAvailable; | |
47 } | 54 } |
48 }; | 55 }; |
49 | 56 |
50 // Export | 57 // Export |
51 return { | 58 return { |
52 SelectionOnly: SelectionOnly | 59 PrintFriendly: PrintFriendly |
53 }; | 60 }; |
54 }); | 61 }); |
OLD | NEW |