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 * Page range ticket item whose value is a {@code string} that represents | 9 * Page range ticket item whose value is a {@code string} that represents |
10 * which pages in the document should be printed. | 10 * which pages in the document should be printed. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 /** @override */ | 64 /** @override */ |
65 getCapabilityNotAvailableValueInternal: function() { | 65 getCapabilityNotAvailableValueInternal: function() { |
66 return ''; | 66 return ''; |
67 }, | 67 }, |
68 | 68 |
69 /** | 69 /** |
70 * @return {!Array.<object.<{from: number, to: number}>>} A list of page | 70 * @return {!Array.<object.<{from: number, to: number}>>} A list of page |
71 * ranges. | 71 * ranges. |
72 */ | 72 */ |
73 getPageRanges: function() { | 73 getPageRanges: function() { |
74 var page_ranges = pageRangeTextToPageRanges(this.getValue()); | 74 return pageRangeTextToPageRanges(this.getValue()) || []; |
75 return page_ranges ? page_ranges : []; | |
76 }, | 75 }, |
77 | 76 |
78 /** | 77 /** |
79 * @return {!Array.<object.<{from: number, to: number}>>} A list of page | 78 * @return {!Array.<object.<{from: number, to: number}>>} A list of page |
80 * ranges suitable for use in the native layer. | 79 * ranges suitable for use in the native layer. |
81 * TODO(vitalybuka): this should be removed when native layer switched to | 80 * TODO(vitalybuka): this should be removed when native layer switched to |
82 * page ranges. | 81 * page ranges. |
83 */ | 82 */ |
84 getDocumentPageRanges: function() { | 83 getDocumentPageRanges: function() { |
85 var page_ranges = pageRangeTextToPageRanges(this.getValue(), | 84 var pageRanges = pageRangeTextToPageRanges(this.getValue(), |
86 this.documentInfo_.pageCount); | 85 this.documentInfo_.pageCount); |
87 return page_ranges ? page_ranges : []; | 86 return pageRanges || []; |
88 }, | 87 }, |
89 }; | 88 }; |
90 | 89 |
91 // Export | 90 // Export |
92 return { | 91 return { |
93 PageRange: PageRange | 92 PageRange: PageRange |
94 }; | 93 }; |
95 }); | 94 }); |
OLD | NEW |