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 // require: cr/ui/print_preview_cloud.js | 5 // require: cr/ui/print_preview_cloud.js |
6 | 6 |
7 var localStrings = new LocalStrings(); | 7 var localStrings = new LocalStrings(); |
8 | 8 |
9 // If useCloudPrint is true we attempt to connect to cloud print | 9 // If useCloudPrint is true we attempt to connect to cloud print |
10 // and populate the list of printers with cloud print printers. | 10 // and populate the list of printers with cloud print printers. |
11 var useCloudPrint = false; | 11 var useCloudPrint = false; |
12 | 12 |
13 // Store the last selected printer index. | 13 // Store the last selected printer index. |
14 var lastSelectedPrinterIndex = 0; | 14 var lastSelectedPrinterIndex = 0; |
15 | 15 |
16 // Used to disable some printing options when the preview is not modifiable. | 16 // Used to disable some printing options when the preview is not modifiable. |
17 var previewModifiable = false; | 17 var previewModifiable = false; |
18 | 18 |
| 19 // Used to identify whether the printing frame has specific page size style. |
| 20 var hasPageSizeStyle = false; |
| 21 |
19 // Destination list special value constants. | 22 // Destination list special value constants. |
20 const MANAGE_CLOUD_PRINTERS = 'manageCloudPrinters'; | 23 const MANAGE_CLOUD_PRINTERS = 'manageCloudPrinters'; |
21 const MANAGE_LOCAL_PRINTERS = 'manageLocalPrinters'; | 24 const MANAGE_LOCAL_PRINTERS = 'manageLocalPrinters'; |
22 const SIGN_IN = 'signIn'; | 25 const SIGN_IN = 'signIn'; |
23 const PRINT_TO_PDF = 'Print to PDF'; | 26 const PRINT_TO_PDF = 'Print to PDF'; |
24 const PRINT_WITH_CLOUD_PRINT = 'printWithCloudPrint'; | 27 const PRINT_WITH_CLOUD_PRINT = 'printWithCloudPrint'; |
25 | 28 |
26 // State of the print preview settings. | 29 // State of the print preview settings. |
27 var printSettings = new PrintSettings(); | 30 var printSettings = new PrintSettings(); |
28 | 31 |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 function setPluginPreviewPageCount() { | 818 function setPluginPreviewPageCount() { |
816 $('pdf-viewer').printPreviewPageCount( | 819 $('pdf-viewer').printPreviewPageCount( |
817 pageSettings.previouslySelectedPages.length); | 820 pageSettings.previouslySelectedPages.length); |
818 } | 821 } |
819 | 822 |
820 /** | 823 /** |
821 * Update the page count and check the page range. | 824 * Update the page count and check the page range. |
822 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). | 825 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). |
823 * @param {number} pageCount The number of pages. | 826 * @param {number} pageCount The number of pages. |
824 * @param {number} previewResponseId The preview request id that resulted in | 827 * @param {number} previewResponseId The preview request id that resulted in |
825 * this response. | 828 * this response. |
| 829 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed |
| 830 * document has a custom page size style. |
826 */ | 831 */ |
827 function onDidGetPreviewPageCount(pageCount, previewResponseId) { | 832 function onDidGetPreviewPageCount(pageCount, previewResponseId, |
| 833 hasCustomPageSizeStyle) { |
828 if (!isExpectedPreviewResponse(previewResponseId)) | 834 if (!isExpectedPreviewResponse(previewResponseId)) |
829 return; | 835 return; |
830 pageSettings.updateState(pageCount); | 836 pageSettings.updateState(pageCount); |
| 837 hasPageSizeStyle = hasCustomPageSizeStyle; |
831 if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded()) | 838 if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded()) |
832 return; | 839 return; |
833 | 840 |
834 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY); | 841 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY); |
835 } | 842 } |
836 | 843 |
837 /** | 844 /** |
838 * @param {printing::PageSizeMargins} pageLayout The default layout of the page | 845 * @param {printing::PageSizeMargins} pageLayout The default layout of the page |
839 * in points. | 846 * in points. |
840 */ | 847 */ |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 <include src="copies_settings.js"/> | 1152 <include src="copies_settings.js"/> |
1146 <include src="header_footer_settings.js"/> | 1153 <include src="header_footer_settings.js"/> |
1147 <include src="layout_settings.js"/> | 1154 <include src="layout_settings.js"/> |
1148 <include src="color_settings.js"/> | 1155 <include src="color_settings.js"/> |
1149 <include src="margin_settings.js"/> | 1156 <include src="margin_settings.js"/> |
1150 <include src="margin_textbox.js"/> | 1157 <include src="margin_textbox.js"/> |
1151 <include src="margin_utils.js"/> | 1158 <include src="margin_utils.js"/> |
1152 <include src="margins_ui.js"/> | 1159 <include src="margins_ui.js"/> |
1153 <include src="margins_ui_pair.js"/> | 1160 <include src="margins_ui_pair.js"/> |
1154 <include src="preview_area.js"/> | 1161 <include src="preview_area.js"/> |
OLD | NEW |