Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: chrome/browser/resources/print_preview/print_preview.js

Issue 8585017: PrintPreview: Honor the print media page size and margin values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added one more test Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 function setPluginPreviewPageCount() { 831 function setPluginPreviewPageCount() {
829 $('pdf-viewer').printPreviewPageCount( 832 $('pdf-viewer').printPreviewPageCount(
830 pageSettings.previouslySelectedPages.length); 833 pageSettings.previouslySelectedPages.length);
831 } 834 }
832 835
833 /** 836 /**
834 * Update the page count and check the page range. 837 * Update the page count and check the page range.
835 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). 838 * Called from PrintPreviewUI::OnDidGetPreviewPageCount().
836 * @param {number} pageCount The number of pages. 839 * @param {number} pageCount The number of pages.
837 * @param {number} previewResponseId The preview request id that resulted in 840 * @param {number} previewResponseId The preview request id that resulted in
838 * this response. 841 * this response.
839 */ 842 */
840 function onDidGetPreviewPageCount(pageCount, previewResponseId) { 843 function onDidGetPreviewPageCount(pageCount, previewResponseId) {
841 if (!isExpectedPreviewResponse(previewResponseId)) 844 if (!isExpectedPreviewResponse(previewResponseId))
842 return; 845 return;
843 pageSettings.updateState(pageCount); 846 pageSettings.updateState(pageCount);
844 if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded()) 847 if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded())
845 return; 848 return;
846 849
847 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY); 850 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY);
848 } 851 }
849 852
850 /** 853 /**
851 * @param {printing::PageSizeMargins} pageLayout The default layout of the page 854 * @param {printing::PageSizeMargins} pageLayout The default layout of the page
852 * in points. 855 * in points.
856 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed
857 * document has a custom page size style.
853 */ 858 */
854 function onDidGetDefaultPageLayout(pageLayout) { 859 function onDidGetDefaultPageLayout(pageLayout, hasCustomPageSizeStyle) {
860 hasPageSizeStyle = hasCustomPageSizeStyle;
855 marginSettings.currentDefaultPageLayout = new print_preview.PageLayout( 861 marginSettings.currentDefaultPageLayout = new print_preview.PageLayout(
856 pageLayout.contentWidth, 862 pageLayout.contentWidth,
857 pageLayout.contentHeight, 863 pageLayout.contentHeight,
858 pageLayout.marginLeft, 864 pageLayout.marginLeft,
859 pageLayout.marginTop, 865 pageLayout.marginTop,
860 pageLayout.marginRight, 866 pageLayout.marginRight,
861 pageLayout.marginBottom); 867 pageLayout.marginBottom);
862 } 868 }
863 869
864 /** 870 /**
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 <include src="copies_settings.js"/> 1166 <include src="copies_settings.js"/>
1161 <include src="header_footer_settings.js"/> 1167 <include src="header_footer_settings.js"/>
1162 <include src="layout_settings.js"/> 1168 <include src="layout_settings.js"/>
1163 <include src="color_settings.js"/> 1169 <include src="color_settings.js"/>
1164 <include src="margin_settings.js"/> 1170 <include src="margin_settings.js"/>
1165 <include src="margin_textbox.js"/> 1171 <include src="margin_textbox.js"/>
1166 <include src="margin_utils.js"/> 1172 <include src="margin_utils.js"/>
1167 <include src="margins_ui.js"/> 1173 <include src="margins_ui.js"/>
1168 <include src="margins_ui_pair.js"/> 1174 <include src="margins_ui_pair.js"/>
1169 <include src="preview_area.js"/> 1175 <include src="preview_area.js"/>
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/layout_settings.js ('k') | chrome/browser/ui/webui/print_preview_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698