| 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 24 matching lines...) Expand all Loading... |
| 35 return this.headerFooterCheckbox_.checked; | 35 return this.headerFooterCheckbox_.checked; |
| 36 }, | 36 }, |
| 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('PDFLoaded', this.onPDFLoaded_.bind(this)); | 45 document.addEventListener(customEvents.PDF_LOADED, |
| 46 this.onPDFLoaded_.bind(this)); |
| 46 }, | 47 }, |
| 47 | 48 |
| 48 /** | 49 /** |
| 49 * Listener executing when the user selects or de-selects the headers | 50 * Listener executing when the user selects or de-selects the headers |
| 50 * and footers option. | 51 * and footers option. |
| 51 * @private | 52 * @private |
| 52 */ | 53 */ |
| 53 onHeaderFooterChanged_: function() { | 54 onHeaderFooterChanged_: function() { |
| 54 requestPrintPreview(); | 55 requestPrintPreview(); |
| 55 }, | 56 }, |
| 56 | 57 |
| 57 /** | 58 /** |
| 58 * Listener executing when a PDFLoaded event occurs. | 59 * Listener executing when a |customEvents.PDF_LOADED| event occurs. |
| 59 * @private | 60 * @private |
| 60 */ | 61 */ |
| 61 onPDFLoaded_: function() { | 62 onPDFLoaded_: function() { |
| 62 if (!previewModifiable) { | 63 if (!previewModifiable) { |
| 63 fadeOutElement(this.headerFooterOption_); | 64 fadeOutElement(this.headerFooterOption_); |
| 64 this.headerFooterCheckbox_.checked = false; | 65 this.headerFooterCheckbox_.checked = false; |
| 65 } | 66 } |
| 66 }, | 67 }, |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 return { | 70 return { |
| 70 HeaderFooterSettings: HeaderFooterSettings, | 71 HeaderFooterSettings: HeaderFooterSettings, |
| 71 }; | 72 }; |
| 72 }); | 73 }); |
| OLD | NEW |