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 * Margins type ticket item whose value is a | 9 * Ticket item whose value is a {@code boolean} that represents whether to |
10 * {@link print_preview.ticket_items.MarginsType.Value} that indicates what | 10 * print CSS backgrounds. |
11 * predefined margins type to use. | |
12 * @param {!print_preview.DocumentInfo} documentInfo Information about the | 11 * @param {!print_preview.DocumentInfo} documentInfo Information about the |
13 * document to print. | 12 * document to print. |
14 * @constructor | 13 * @constructor |
15 * @extends {print_preview.ticket_items.TicketItem} | 14 * @extends {print_preview.ticket_items.TicketItem} |
16 */ | 15 */ |
17 function MarginsType(documentInfo) { | 16 function CssBackground(documentInfo) { |
18 print_preview.ticket_items.TicketItem.call(this); | 17 print_preview.ticket_items.TicketItem.call(this); |
19 | 18 |
20 /** | 19 /** |
21 * Information about the document to print. | 20 * Information about the document to print. |
22 * @type {!print_preview.DocumentInfo} | 21 * @type {!print_preview.DocumentInfo} |
23 * @private | 22 * @private |
24 */ | 23 */ |
25 this.documentInfo_ = documentInfo; | 24 this.documentInfo_ = documentInfo; |
26 }; | 25 }; |
27 | 26 |
28 /** | 27 CssBackground.prototype = { |
29 * Enumeration of margin types. Matches enum MarginType in | |
30 * printing/print_job_constants.h. | |
31 * @enum {number} | |
32 */ | |
33 MarginsType.Value = { | |
34 DEFAULT: 0, | |
35 NO_MARGINS: 1, | |
36 MINIMUM: 2, | |
37 CUSTOM: 3 | |
38 }; | |
39 | |
40 MarginsType.prototype = { | |
41 __proto__: print_preview.ticket_items.TicketItem.prototype, | 28 __proto__: print_preview.ticket_items.TicketItem.prototype, |
42 | 29 |
43 /** @override */ | 30 /** @override */ |
44 wouldValueBeValid: function(value) { | 31 wouldValueBeValid: function(value) { |
45 return true; | 32 return true; |
46 }, | 33 }, |
47 | 34 |
48 /** @override */ | 35 /** @override */ |
49 isCapabilityAvailable: function() { | 36 isCapabilityAvailable: function() { |
50 return this.documentInfo_.isModifiable; | 37 return this.documentInfo_.isModifiable; |
51 }, | 38 }, |
52 | 39 |
53 /** @override */ | 40 /** @override */ |
54 getDefaultValueInternal: function() { | 41 getDefaultValueInternal: function() { |
55 return MarginsType.Value.DEFAULT; | 42 return false; |
56 }, | 43 }, |
57 | 44 |
58 /** @override */ | 45 /** @override */ |
59 getCapabilityNotAvailableValueInternal: function() { | 46 getCapabilityNotAvailableValueInternal: function() { |
60 return MarginsType.Value.DEFAULT; | 47 return false; |
61 } | 48 } |
62 }; | 49 }; |
63 | 50 |
64 // Export | 51 // Export |
65 return { | 52 return { |
66 MarginsType: MarginsType | 53 CssBackground: CssBackground |
67 }; | 54 }; |
68 }); | 55 }); |
OLD | NEW |