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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 function setPluginPreviewPageCount() { | 823 function setPluginPreviewPageCount() { |
821 $('pdf-viewer').printPreviewPageCount( | 824 $('pdf-viewer').printPreviewPageCount( |
822 pageSettings.previouslySelectedPages.length); | 825 pageSettings.previouslySelectedPages.length); |
823 } | 826 } |
824 | 827 |
825 /** | 828 /** |
826 * Update the page count and check the page range. | 829 * Update the page count and check the page range. |
827 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). | 830 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). |
828 * @param {number} pageCount The number of pages. | 831 * @param {number} pageCount The number of pages. |
829 * @param {number} previewResponseId The preview request id that resulted in | 832 * @param {number} previewResponseId The preview request id that resulted in |
830 * this response. | 833 * this response. |
831 */ | 834 */ |
832 function onDidGetPreviewPageCount(pageCount, previewResponseId) { | 835 function onDidGetPreviewPageCount(pageCount, previewResponseId) { |
833 if (!isExpectedPreviewResponse(previewResponseId)) | 836 if (!isExpectedPreviewResponse(previewResponseId)) |
834 return; | 837 return; |
835 pageSettings.updateState(pageCount); | 838 pageSettings.updateState(pageCount); |
836 if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded()) | 839 if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded()) |
837 return; | 840 return; |
838 | 841 |
839 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY); | 842 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY); |
840 } | 843 } |
841 | 844 |
842 /** | 845 /** |
843 * @param {printing::PageSizeMargins} pageLayout The default layout of the page | 846 * @param {printing::PageSizeMargins} pageLayout The default layout of the page |
844 * in points. | 847 * in points. |
| 848 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed |
| 849 * document has a custom page size style. |
845 */ | 850 */ |
846 function onDidGetDefaultPageLayout(pageLayout) { | 851 function onDidGetDefaultPageLayout(pageLayout, hasCustomPageSizeStyle) { |
| 852 hasPageSizeStyle = hasCustomPageSizeStyle; |
847 marginSettings.currentDefaultPageLayout = new print_preview.PageLayout( | 853 marginSettings.currentDefaultPageLayout = new print_preview.PageLayout( |
848 pageLayout.contentWidth, | 854 pageLayout.contentWidth, |
849 pageLayout.contentHeight, | 855 pageLayout.contentHeight, |
850 pageLayout.marginLeft, | 856 pageLayout.marginLeft, |
851 pageLayout.marginTop, | 857 pageLayout.marginTop, |
852 pageLayout.marginRight, | 858 pageLayout.marginRight, |
853 pageLayout.marginBottom); | 859 pageLayout.marginBottom); |
854 } | 860 } |
855 | 861 |
856 /** | 862 /** |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 <include src="copies_settings.js"/> | 1158 <include src="copies_settings.js"/> |
1153 <include src="header_footer_settings.js"/> | 1159 <include src="header_footer_settings.js"/> |
1154 <include src="layout_settings.js"/> | 1160 <include src="layout_settings.js"/> |
1155 <include src="color_settings.js"/> | 1161 <include src="color_settings.js"/> |
1156 <include src="margin_settings.js"/> | 1162 <include src="margin_settings.js"/> |
1157 <include src="margin_textbox.js"/> | 1163 <include src="margin_textbox.js"/> |
1158 <include src="margin_utils.js"/> | 1164 <include src="margin_utils.js"/> |
1159 <include src="margins_ui.js"/> | 1165 <include src="margins_ui.js"/> |
1160 <include src="margins_ui_pair.js"/> | 1166 <include src="margins_ui_pair.js"/> |
1161 <include src="preview_area.js"/> | 1167 <include src="preview_area.js"/> |
OLD | NEW |