| 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 17bdbcf3819108254bc5aa883254a9202965f137..2e8e9797d8076a6f3b1f10afe3daf546907df1d3 100644
|
| --- a/chrome/browser/resources/print_preview/print_preview.js
|
| +++ b/chrome/browser/resources/print_preview/print_preview.js
|
| @@ -112,6 +112,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); };
|
| @@ -127,6 +128,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;
|
| @@ -321,6 +323,15 @@ function areSettingsValid() {
|
| }
|
|
|
| /**
|
| + * 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.
|
| @@ -339,6 +350,7 @@ function getSettings() {
|
| 'landscape': layoutSettings.isLandscape(),
|
| 'color': isColor(),
|
| 'printToPDF': printToPDF,
|
| + 'headerFooter': hasHeaderFooter(),
|
| 'requestID': 0};
|
|
|
| var printerList = $('printer-list');
|
| @@ -794,6 +806,9 @@ function onPDFLoad() {
|
| setColor($('color').checked);
|
| hideLoadingAnimation();
|
|
|
| + if (!previewModifiable)
|
| + fadeOutElement($('options-option'));
|
| +
|
| cr.dispatchSimpleEvent(document, 'PDFLoaded');
|
| }
|
|
|
| @@ -867,6 +882,10 @@ function checkIfSettingsChangedAndRegeneratePreview() {
|
| setDefaultValuesAndRegeneratePreview();
|
| return true;
|
| }
|
| + if (printSettings.hasHeaderFooter != tempPrintSettings.hasHeaderFooter) {
|
| + requestPrintPreview();
|
| + return true;
|
| + }
|
| if (pageSettings.requestPrintPreviewIfNeeded())
|
| return true;
|
|
|
| @@ -915,6 +934,14 @@ function checkCompatiblePluginExists() {
|
| window.addEventListener('DOMContentLoaded', onLoad);
|
|
|
| /**
|
| + * When the user selects or de-selects the headers and footers option then a
|
| + * new preview is requested.
|
| + */
|
| +function onHeaderFooterChanged() {
|
| + requestPrintPreview();
|
| +}
|
| +
|
| +/**
|
| * Sets the default values and sends a request to regenerate preview data.
|
| */
|
| function setDefaultValuesAndRegeneratePreview() {
|
| @@ -928,6 +955,7 @@ function setDefaultValuesAndRegeneratePreview() {
|
| function PrintSettings() {
|
| this.deviceName = '';
|
| this.isLandscape = '';
|
| + this.hasHeaderFooter = '';
|
| }
|
|
|
| /**
|
| @@ -936,5 +964,6 @@ function PrintSettings() {
|
| PrintSettings.prototype.save = function() {
|
| this.deviceName = getSelectedPrinterName();
|
| this.isLandscape = layoutSettings.isLandscape();
|
| + this.hasHeaderFooter = hasHeaderFooter();
|
| }
|
|
|
|
|