| Index: chrome/browser/resources/print_preview/print_preview.js
|
| diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
|
| index 83c541d025a16541f0d2ac63acd81a2480d4bf8c..add1448f12967e42955036dcb182fd244974b26a 100644
|
| --- a/chrome/browser/resources/print_preview/print_preview.js
|
| +++ b/chrome/browser/resources/print_preview/print_preview.js
|
| @@ -101,6 +101,7 @@ function onLoad() {
|
| function addEventListeners() {
|
| // Controls that require preview rendering.
|
| $('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities;
|
| + $('header-footer').onclick = onHeaderFooterChanged;
|
|
|
| // Controls that do not require preview rendering.
|
| $('color').onclick = function() { setColor(true); };
|
| @@ -116,6 +117,7 @@ function removeEventListeners() {
|
|
|
| // Controls that require preview rendering
|
| $('printer-list').onchange = null;
|
| + $('header-footer').onclick = null;
|
|
|
| // Controls that don't require preview rendering.
|
| $('color').onclick = null;
|
| @@ -303,6 +305,15 @@ function isColor() {
|
| }
|
|
|
| /**
|
| + * Checks whether the Headers and Footers checkbox is checked or not.
|
| + *
|
| + * @return {boolean} true if Headers and Footers are checked.
|
| + */
|
| +function hasHeaderFooter() {
|
| + return $('header-footer').checked;
|
| +}
|
| +
|
| +/**
|
| * Creates an object based on the values in the printer settings.
|
| *
|
| * @return {Object} Object containing print job settings.
|
| @@ -321,6 +332,7 @@ function getSettings() {
|
| 'landscape': layoutSettings.isLandscape(),
|
| 'color': isColor(),
|
| 'printToPDF': printToPDF,
|
| + 'headerFooter': hasHeaderFooter(),
|
| 'requestID': 0};
|
|
|
| var printerList = $('printer-list');
|
| @@ -740,6 +752,9 @@ function onPDFLoad() {
|
| setColor($('color').checked);
|
| hideLoadingAnimation();
|
|
|
| + if (!previewModifiable) {
|
| + fadeOutElement($('options-option'));
|
| + }
|
| cr.dispatchSimpleEvent(document, 'PDFLoaded');
|
| }
|
|
|
| @@ -813,6 +828,10 @@ function checkIfSettingsChangedAndRegeneratePreview() {
|
| setDefaultValuesAndRegeneratePreview();
|
| return true;
|
| }
|
| + if (printSettings.hasHeaderFooter != tempPrintSettings.hasHeaderFooter) {
|
| + requestPrintPreview();
|
| + return true;
|
| + }
|
| if (pageSettings.requestPrintPreviewIfNeeded())
|
| return true;
|
|
|
| @@ -932,6 +951,14 @@ function updatePrintSummary() {
|
| }
|
|
|
| /**
|
| + * When the user selects or de-selects the headers and footers option then we
|
| + * regenerate the preview pdf.
|
| + */
|
| +function onHeaderFooterChanged() {
|
| + requestPrintPreview();
|
| +}
|
| +
|
| +/**
|
| * Sets the default values and sends a request to regenerate preview data.
|
| */
|
| function setDefaultValuesAndRegeneratePreview() {
|
| @@ -945,6 +972,7 @@ function setDefaultValuesAndRegeneratePreview() {
|
| function PrintSettings() {
|
| this.deviceName = '';
|
| this.isLandscape = '';
|
| + this.hasHeaderFooter = '';
|
| }
|
|
|
| /**
|
| @@ -953,5 +981,6 @@ function PrintSettings() {
|
| PrintSettings.prototype.save = function() {
|
| this.deviceName = getSelectedPrinterName();
|
| this.isLandscape = layoutSettings.isLandscape();
|
| + this.hasHeaderFooter = hasHeaderFooter();
|
| }
|
|
|
|
|