| 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 PrintHeader object. This object encapsulates all the elements | 9 * Creates a PrintHeader object. This object encapsulates all the elements |
| 10 * and logic related to the top part of the left pane in print_preview.html. | 10 * and logic related to the top part of the left pane in print_preview.html. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 this.disableCancelButton(); | 43 this.disableCancelButton(); |
| 44 closePrintPreviewTab(); | 44 closePrintPreviewTab(); |
| 45 }.bind(this); | 45 }.bind(this); |
| 46 this.printButton_.onclick = this.onPrintButtonClicked_.bind(this); | 46 this.printButton_.onclick = this.onPrintButtonClicked_.bind(this); |
| 47 document.addEventListener('updateSummary', | 47 document.addEventListener('updateSummary', |
| 48 this.updateSummary_.bind(this)); | 48 this.updateSummary_.bind(this)); |
| 49 document.addEventListener('updatePrintButton', | 49 document.addEventListener('updatePrintButton', |
| 50 this.updatePrintButton_.bind(this)); | 50 this.updatePrintButton_.bind(this)); |
| 51 document.addEventListener('disableCancelButton', | 51 document.addEventListener('disableCancelButton', |
| 52 this.disableCancelButton.bind(this)); | 52 this.disableCancelButton.bind(this)); |
| 53 document.addEventListener('PDFGenerationError', |
| 54 this.onPDFGenerationError_.bind(this)); |
| 53 }, | 55 }, |
| 54 | 56 |
| 55 /** | 57 /** |
| 58 * Executes when an |PDFGenerationError| event is occurs. |
| 59 * @private |
| 60 */ |
| 61 onPDFGenerationError_: function() { |
| 62 this.printButton_.disabled = true; |
| 63 }, |
| 64 |
| 65 /** |
| 56 * Disables the cancel button and removes its keydown event listener. | 66 * Disables the cancel button and removes its keydown event listener. |
| 57 */ | 67 */ |
| 58 disableCancelButton: function() { | 68 disableCancelButton: function() { |
| 59 window.onkeydown = null; | 69 window.onkeydown = null; |
| 60 this.cancelButton_.disabled = true; | 70 this.cancelButton_.disabled = true; |
| 61 }, | 71 }, |
| 62 | 72 |
| 63 /** | 73 /** |
| 64 * Listener executing whenever |this.printButton_| is clicked. | 74 * Listener executing whenever |this.printButton_| is clicked. |
| 65 * @private | 75 * @private |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Removing extra spaces from within the string. | 155 // Removing extra spaces from within the string. |
| 146 html = html.replace(/\s{2,}/g, ' '); | 156 html = html.replace(/\s{2,}/g, ' '); |
| 147 this.summary_.innerHTML = html; | 157 this.summary_.innerHTML = html; |
| 148 }, | 158 }, |
| 149 }; | 159 }; |
| 150 | 160 |
| 151 return { | 161 return { |
| 152 PrintHeader: PrintHeader, | 162 PrintHeader: PrintHeader, |
| 153 }; | 163 }; |
| 154 }); | 164 }); |
| OLD | NEW |