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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 this.printButton_.onclick = this.onPrintButtonClicked_.bind(this); | 46 this.printButton_.onclick = this.onPrintButtonClicked_.bind(this); |
47 document.addEventListener(customEvents.UPDATE_SUMMARY, | 47 document.addEventListener(customEvents.UPDATE_SUMMARY, |
48 this.updateSummary_.bind(this)); | 48 this.updateSummary_.bind(this)); |
49 document.addEventListener(customEvents.UPDATE_PRINT_BUTTON, | 49 document.addEventListener(customEvents.UPDATE_PRINT_BUTTON, |
50 this.updatePrintButton_.bind(this)); | 50 this.updatePrintButton_.bind(this)); |
51 document.addEventListener(customEvents.PDF_GENERATION_ERROR, | 51 document.addEventListener(customEvents.PDF_GENERATION_ERROR, |
52 this.onPDFGenerationError_.bind(this)); | 52 this.onPDFGenerationError_.bind(this)); |
53 }, | 53 }, |
54 | 54 |
55 /** | 55 /** |
| 56 * Enables the cancel button and attaches its keydown event listener. |
| 57 */ |
| 58 enableCancelButton: function() { |
| 59 window.onkeydown = onKeyDown; |
| 60 this.cancelButton_.disabled = false; |
| 61 }, |
| 62 |
| 63 /** |
56 * Executes when a |customEvents.PDF_GENERATION_ERROR| event occurs. | 64 * Executes when a |customEvents.PDF_GENERATION_ERROR| event occurs. |
57 * @private | 65 * @private |
58 */ | 66 */ |
59 onPDFGenerationError_: function() { | 67 onPDFGenerationError_: function() { |
60 this.printButton_.disabled = true; | 68 this.printButton_.disabled = true; |
61 }, | 69 }, |
62 | 70 |
63 /** | 71 /** |
64 * Disables the cancel button and removes its keydown event listener. | 72 * Disables the cancel button and removes its keydown event listener. |
65 */ | 73 */ |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Removing extra spaces from within the string. | 161 // Removing extra spaces from within the string. |
154 html = html.replace(/\s{2,}/g, ' '); | 162 html = html.replace(/\s{2,}/g, ' '); |
155 this.summary_.innerHTML = html; | 163 this.summary_.innerHTML = html; |
156 }, | 164 }, |
157 }; | 165 }; |
158 | 166 |
159 return { | 167 return { |
160 PrintHeader: PrintHeader, | 168 PrintHeader: PrintHeader, |
161 }; | 169 }; |
162 }); | 170 }); |
OLD | NEW |