Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Creates a HeaderFooterSettings object. This object encapsulates all | 9 * Creates a HeaderFooterSettings object. This object encapsulates all |
| 10 * settings and logic related to the headers and footers checkbox. | 10 * settings and logic related to the headers and footers checkbox. |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Adding listeners to header footer related controls. | 39 * Adding listeners to header footer related controls. |
| 40 * @private | 40 * @private |
| 41 */ | 41 */ |
| 42 addEventListeners_: function() { | 42 addEventListeners_: function() { |
| 43 this.headerFooterCheckbox_.onclick = | 43 this.headerFooterCheckbox_.onclick = |
| 44 this.onHeaderFooterChanged_.bind(this); | 44 this.onHeaderFooterChanged_.bind(this); |
| 45 document.addEventListener(customEvents.PDF_LOADED, | 45 document.addEventListener(customEvents.PDF_LOADED, |
| 46 this.onPDFLoaded_.bind(this)); | 46 this.onPDFLoaded_.bind(this)); |
| 47 document.addEventListener(customEvents.MARGINS_SELECTION_CHANGED, | |
| 48 this.onMarginsSelectionChanged_.bind(this)); | |
| 49 }, | |
| 50 | |
| 51 onMarginsSelectionChanged_: function(event) { | |
| 52 this.setVisible_(event.selectedMargins != | |
| 53 print_preview.MarginSettings.MARGINS_VALUE_NO_MARGINS); | |
| 47 }, | 54 }, |
| 48 | 55 |
| 49 /** | 56 /** |
| 50 * Listener executing when the user selects or de-selects the headers | 57 * Listener executing when the user selects or de-selects the headers |
| 51 * and footers option. | 58 * and footers option. |
| 52 * @private | 59 * @private |
| 53 */ | 60 */ |
| 54 onHeaderFooterChanged_: function() { | 61 onHeaderFooterChanged_: function() { |
| 55 requestPrintPreview(); | 62 requestPrintPreview(); |
| 56 }, | 63 }, |
| 57 | 64 |
| 58 /** | 65 /** |
| 59 * Listener executing when a |customEvents.PDF_LOADED| event occurs. | 66 * Listener executing when a |customEvents.PDF_LOADED| event occurs. |
| 60 * @private | 67 * @private |
| 61 */ | 68 */ |
| 62 onPDFLoaded_: function() { | 69 onPDFLoaded_: function() { |
| 63 if (!previewModifiable) { | 70 if (!previewModifiable) |
| 71 this.setVisible_(previewModifiable); | |
| 72 }, | |
| 73 | |
| 74 /** | |
| 75 * Hides or shows |this.headerFooterOption|. | |
| 76 * @{param} visible True if |this.headerFooterOption| should be shown. | |
| 77 * @private | |
| 78 */ | |
| 79 setVisible_: function(visible) { | |
| 80 if (visible) { | |
| 81 fadeInOption(this.headerFooterOption_); | |
| 82 } else { | |
| 64 fadeOutOption(this.headerFooterOption_); | 83 fadeOutOption(this.headerFooterOption_); |
| 65 this.headerFooterCheckbox_.checked = false; | 84 this.headerFooterCheckbox_.checked = false; |
|
dpapad
2011/11/29 17:29:09
When hiding this option we also set it to not chec
kmadhusu
2011/11/29 17:48:59
Consider the following scenario:
1. User previews
dpapad
2011/11/29 19:32:07
Done.
| |
| 66 } | 85 } |
| 67 }, | 86 }, |
| 68 }; | 87 }; |
| 69 | 88 |
| 70 return { | 89 return { |
| 71 HeaderFooterSettings: HeaderFooterSettings, | 90 HeaderFooterSettings: HeaderFooterSettings, |
| 72 }; | 91 }; |
| 73 }); | 92 }); |
| OLD | NEW |