Chromium Code Reviews| 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 35ec000338f2f92da3c38462ea19c040f2c210a9..c279e8e1dbed5d0cc0dc2f4bc5fcc4192f1dfad4 100644 |
| --- a/chrome/browser/resources/print_preview/print_preview.js |
| +++ b/chrome/browser/resources/print_preview/print_preview.js |
| @@ -116,6 +116,7 @@ function onLoad() { |
| function addEventListeners() { |
| // Controls that require preview rendering. |
| $('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities; |
| + $('header-footer').onclick = onHeaderFooterChanged; |
| } |
| /** |
| @@ -127,6 +128,7 @@ function removeEventListeners() { |
| // Controls that require preview rendering |
| $('printer-list').onchange = null; |
| + $('header-footer').onclick = null; |
| } |
| /** |
| @@ -293,6 +295,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. |
| @@ -311,6 +322,7 @@ function getSettings() { |
| 'landscape': layoutSettings.isLandscape(), |
| 'color': colorSettings.isColor(), |
| 'printToPDF': printToPDF, |
| + 'headerFooter': hasHeaderFooter(), |
| 'requestID': 0}; |
| var printerList = $('printer-list'); |
| @@ -777,6 +789,8 @@ function onPDFLoad() { |
| cr.dispatchSimpleEvent(document, 'updateSummary'); |
| } |
| $('pdf-viewer').fitToHeight(); |
| + if (!previewModifiable) |
| + fadeOutElement($('options-option')); |
|
kmadhusu
2011/07/28 20:31:20
Can you add line #793 in the else block of line #7
Aayush Kumar
2011/07/29 00:21:46
Done.
|
| cr.dispatchSimpleEvent(document, 'PDFLoaded'); |
| hideLoadingAnimation(); |
| } |
| @@ -891,6 +905,10 @@ function checkIfSettingsChangedAndRegeneratePreview() { |
| setDefaultValuesAndRegeneratePreview(); |
| return true; |
| } |
| + if (printSettings.hasHeaderFooter != tempPrintSettings.hasHeaderFooter) { |
| + requestPrintPreview(); |
| + return true; |
| + } |
| if (pageSettings.requestPrintPreviewIfNeeded()) |
| return true; |
| @@ -943,6 +961,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() { |
| @@ -956,6 +982,7 @@ function setDefaultValuesAndRegeneratePreview() { |
| function PrintSettings() { |
| this.deviceName = ''; |
| this.isLandscape = ''; |
| + this.hasHeaderFooter = ''; |
| } |
| /** |
| @@ -964,5 +991,6 @@ function PrintSettings() { |
| PrintSettings.prototype.save = function() { |
| this.deviceName = getSelectedPrinterName(); |
| this.isLandscape = layoutSettings.isLandscape(); |
| + this.hasHeaderFooter = hasHeaderFooter(); |
| } |