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 * Header-footer ticket item whose value is a {@code boolean} that indicates | 9 * Header-footer ticket item whose value is a {@code boolean} that indicates |
10 * whether the document should be printed with headers and footers. | 10 * whether the document should be printed with headers and footers. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 wouldValueBeValid: function(value) { | 75 wouldValueBeValid: function(value) { |
76 return true; | 76 return true; |
77 }, | 77 }, |
78 | 78 |
79 /** @override */ | 79 /** @override */ |
80 isCapabilityAvailable: function() { | 80 isCapabilityAvailable: function() { |
81 if (!this.getDocumentInfoInternal().isModifiable) { | 81 if (!this.getDocumentInfoInternal().isModifiable) { |
82 return false; | 82 return false; |
83 } | 83 } |
84 if (this.marginsType_.getValue() == | 84 if (this.marginsType_.getValue() == |
85 print_preview.ticket_items.MarginsType.Value.NO_MARGINS) { | 85 print_preview.ticket_items.MarginsTypeValue.NO_MARGINS) { |
86 return false; | 86 return false; |
87 } | 87 } |
88 var microns = this.landscape_.getValue() ? | 88 var microns = this.landscape_.getValue() ? |
89 this.mediaSize_.getValue().width_microns : | 89 this.mediaSize_.getValue().width_microns : |
90 this.mediaSize_.getValue().height_microns; | 90 this.mediaSize_.getValue().height_microns; |
91 if (microns < HeaderFooter.MINIMUM_HEIGHT_MICRONS_) { | 91 if (microns < HeaderFooter.MINIMUM_HEIGHT_MICRONS_) { |
92 // If this is a small paper size, there is not space for headers | 92 // If this is a small paper size, there is not space for headers |
93 // and footers regardless of the margins. | 93 // and footers regardless of the margins. |
94 return false; | 94 return false; |
95 } | 95 } |
96 if (this.marginsType_.getValue() == | 96 if (this.marginsType_.getValue() == |
97 print_preview.ticket_items.MarginsType.Value.MINIMUM) { | 97 print_preview.ticket_items.MarginsTypeValue.MINIMUM) { |
98 return true; | 98 return true; |
99 } | 99 } |
100 var margins; | 100 var margins; |
101 if (this.marginsType_.getValue() == | 101 if (this.marginsType_.getValue() == |
102 print_preview.ticket_items.MarginsType.Value.CUSTOM) { | 102 print_preview.ticket_items.MarginsTypeValue.CUSTOM) { |
103 if (!this.customMargins_.isValid()) { | 103 if (!this.customMargins_.isValid()) { |
104 return false; | 104 return false; |
105 } | 105 } |
106 margins = this.customMargins_.getValue(); | 106 margins = this.customMargins_.getValue(); |
107 } else { | 107 } else { |
108 margins = this.getDocumentInfoInternal().margins; | 108 margins = this.getDocumentInfoInternal().margins; |
109 } | 109 } |
110 var orientEnum = print_preview.ticket_items.CustomMargins.Orientation; | 110 var orientEnum = print_preview.ticket_items.CustomMargins.Orientation; |
111 return margins == null || | 111 return margins == null || |
112 margins.get(orientEnum.TOP) > 0 || | 112 margins.get(orientEnum.TOP) > 0 || |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 print_preview.ticket_items.TicketItem.EventType.CHANGE, | 145 print_preview.ticket_items.TicketItem.EventType.CHANGE, |
146 this.dispatchChangeEventInternal.bind(this)); | 146 this.dispatchChangeEventInternal.bind(this)); |
147 } | 147 } |
148 }; | 148 }; |
149 | 149 |
150 // Export | 150 // Export |
151 return { | 151 return { |
152 HeaderFooter: HeaderFooter | 152 HeaderFooter: HeaderFooter |
153 }; | 153 }; |
154 }); | 154 }); |
OLD | NEW |