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

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

Issue 9699040: PrintPreview: Hide/Show the header footer option based on print frame margins. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: addressed review comments Created 8 years, 9 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) 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 // 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.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Names of all the custom events used. 119 // Names of all the custom events used.
120 var customEvents = { 120 var customEvents = {
121 // Fired when the mouse moves while a margin line is being dragged. 121 // Fired when the mouse moves while a margin line is being dragged.
122 MARGIN_LINE_DRAG: 'marginLineDrag', 122 MARGIN_LINE_DRAG: 'marginLineDrag',
123 // Fired when a mousedown event occurs on a margin line. 123 // Fired when a mousedown event occurs on a margin line.
124 MARGIN_LINE_MOUSE_DOWN: 'marginLineMouseDown', 124 MARGIN_LINE_MOUSE_DOWN: 'marginLineMouseDown',
125 // Fired when a margin textbox gains focus. 125 // Fired when a margin textbox gains focus.
126 MARGIN_TEXTBOX_FOCUSED: 'marginTextboxFocused', 126 MARGIN_TEXTBOX_FOCUSED: 'marginTextboxFocused',
127 // Fired when a new preview might be needed because of margin changes. 127 // Fired when a new preview might be needed because of margin changes.
128 MARGINS_MAY_HAVE_CHANGED: 'marginsMayHaveChanged', 128 MARGINS_MAY_HAVE_CHANGED: 'marginsMayHaveChanged',
129 // Fired when the margins selection in the dropdown changes.
130 MARGINS_SELECTION_CHANGED: 'marginsSelectionChanged',
131 // Fired when a pdf generation related error occurs. 129 // Fired when a pdf generation related error occurs.
132 PDF_GENERATION_ERROR: 'PDFGenerationError', 130 PDF_GENERATION_ERROR: 'PDFGenerationError',
133 // Fired once the first page of the pdf document is loaded in the plugin. 131 // Fired once the first page of the pdf document is loaded in the plugin.
134 PDF_LOADED: 'PDFLoaded', 132 PDF_LOADED: 'PDFLoaded',
135 // Fired when the selected printer capabilities change. 133 // Fired when the selected printer capabilities change.
136 PRINTER_CAPABILITIES_UPDATED: 'printerCapabilitiesUpdated', 134 PRINTER_CAPABILITIES_UPDATED: 'printerCapabilitiesUpdated',
137 // Fired when the print button needs to be updated. 135 // Fired when the print button needs to be updated.
138 UPDATE_PRINT_BUTTON: 'updatePrintButton', 136 UPDATE_PRINT_BUTTON: 'updatePrintButton',
139 // Fired when the print summary needs to be updated. 137 // Fired when the print summary needs to be updated.
140 UPDATE_SUMMARY: 'updateSummary' 138 UPDATE_SUMMARY: 'updateSummary'
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 return; 863 return;
866 864
867 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY); 865 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY);
868 } 866 }
869 867
870 /** 868 /**
871 * @param {printing::PageSizeMargins} pageLayout The default layout of the page 869 * @param {printing::PageSizeMargins} pageLayout The default layout of the page
872 * in points. 870 * in points.
873 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed 871 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed
874 * document has a custom page size style. 872 * document has a custom page size style.
873 * @param {boolean} headerFooterApplies Indicates whether the header
874 * footer is applicable for the given settings.
875 */ 875 */
876 function onDidGetDefaultPageLayout(pageLayout, hasCustomPageSizeStyle) { 876 function onDidGetDefaultPageLayout(pageLayout,
877 hasCustomPageSizeStyle,
878 headerFooterApplies) {
877 hasPageSizeStyle = hasCustomPageSizeStyle; 879 hasPageSizeStyle = hasCustomPageSizeStyle;
878 marginSettings.currentDefaultPageLayout = new print_preview.PageLayout( 880 marginSettings.currentDefaultPageLayout = new print_preview.PageLayout(
879 pageLayout.contentWidth, 881 pageLayout.contentWidth,
880 pageLayout.contentHeight, 882 pageLayout.contentHeight,
881 pageLayout.marginLeft, 883 pageLayout.marginLeft,
882 pageLayout.marginTop, 884 pageLayout.marginTop,
883 pageLayout.marginRight, 885 pageLayout.marginRight,
884 pageLayout.marginBottom); 886 pageLayout.marginBottom);
887 headerFooterSettings.setVisible(headerFooterApplies);
885 } 888 }
886 889
887 /** 890 /**
888 * This function sends a request to hide the overlay layer only if there is no 891 * This function sends a request to hide the overlay layer only if there is no
889 * pending print document request and we are not waiting for the print ready 892 * pending print document request and we are not waiting for the print ready
890 * metafile. 893 * metafile.
891 */ 894 */
892 function checkAndHideOverlayLayerIfValid() { 895 function checkAndHideOverlayLayerIfValid() {
893 var selectedPrinter = getSelectedPrinterName(); 896 var selectedPrinter = getSelectedPrinterName();
894 var printToDialog = selectedPrinter == PRINT_TO_PDF || 897 var printToDialog = selectedPrinter == PRINT_TO_PDF ||
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 <include src="copies_settings.js"/> 1205 <include src="copies_settings.js"/>
1203 <include src="header_footer_settings.js"/> 1206 <include src="header_footer_settings.js"/>
1204 <include src="layout_settings.js"/> 1207 <include src="layout_settings.js"/>
1205 <include src="color_settings.js"/> 1208 <include src="color_settings.js"/>
1206 <include src="margin_settings.js"/> 1209 <include src="margin_settings.js"/>
1207 <include src="margin_textbox.js"/> 1210 <include src="margin_textbox.js"/>
1208 <include src="margin_utils.js"/> 1211 <include src="margin_utils.js"/>
1209 <include src="margins_ui.js"/> 1212 <include src="margins_ui.js"/>
1210 <include src="margins_ui_pair.js"/> 1213 <include src="margins_ui_pair.js"/>
1211 <include src="preview_area.js"/> 1214 <include src="preview_area.js"/>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698