OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Creates a PrintHeader object. This object encapsulates all the elements | 9 * Creates a PrintHeader object. This object encapsulates all the elements |
10 * and logic related to the top part of the left pane in print_preview.html. | 10 * and logic related to the top part of the left pane in print_preview.html. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 updateSummary_: function() { | 81 updateSummary_: function() { |
82 var printToPDF = getSelectedPrinterName() == PRINT_TO_PDF; | 82 var printToPDF = getSelectedPrinterName() == PRINT_TO_PDF; |
83 var copies = printToPDF ? 1 : copiesSettings.numberOfCopies; | 83 var copies = printToPDF ? 1 : copiesSettings.numberOfCopies; |
84 | 84 |
85 if ((!printToPDF && !copiesSettings.isValid()) || | 85 if ((!printToPDF && !copiesSettings.isValid()) || |
86 !pageSettings.isPageSelectionValid()) { | 86 !pageSettings.isPageSelectionValid()) { |
87 this.summary_.innerHTML = ''; | 87 this.summary_.innerHTML = ''; |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
| 91 if (!marginSettings.areMarginSettingsValid()) { |
| 92 this.summary_.innerHTML = |
| 93 localStrings.getString('invalidMarginSettings'); |
| 94 return; |
| 95 } |
| 96 |
91 var pageSet = pageSettings.selectedPagesSet; | 97 var pageSet = pageSettings.selectedPagesSet; |
92 var numOfSheets = pageSet.length; | 98 var numOfSheets = pageSet.length; |
93 var summaryLabel = | 99 var summaryLabel = |
94 localStrings.getString('printPreviewSheetsLabelSingular'); | 100 localStrings.getString('printPreviewSheetsLabelSingular'); |
95 var numOfPagesText = ''; | 101 var numOfPagesText = ''; |
96 var pagesLabel = localStrings.getString('printPreviewPageLabelPlural'); | 102 var pagesLabel = localStrings.getString('printPreviewPageLabelPlural'); |
97 | 103 |
98 if (printToPDF) | 104 if (printToPDF) |
99 summaryLabel = localStrings.getString('printPreviewPageLabelSingular'); | 105 summaryLabel = localStrings.getString('printPreviewPageLabelSingular'); |
100 | 106 |
(...skipping 22 matching lines...) Expand all Loading... |
123 // Removing extra spaces from within the string. | 129 // Removing extra spaces from within the string. |
124 html = html.replace(/\s{2,}/g, ' '); | 130 html = html.replace(/\s{2,}/g, ' '); |
125 this.summary_.innerHTML = html; | 131 this.summary_.innerHTML = html; |
126 }, | 132 }, |
127 }; | 133 }; |
128 | 134 |
129 return { | 135 return { |
130 PrintHeader: PrintHeader, | 136 PrintHeader: PrintHeader, |
131 }; | 137 }; |
132 }); | 138 }); |
OLD | NEW |