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 /** | |
64 * Executes when a |customEvents.PDF_GENERATION_ERROR| event occurs. | 56 * Executes when a |customEvents.PDF_GENERATION_ERROR| event occurs. |
65 * @private | 57 * @private |
66 */ | 58 */ |
67 onPDFGenerationError_: function() { | 59 onPDFGenerationError_: function() { |
68 this.printButton_.disabled = true; | 60 this.printButton_.disabled = true; |
69 }, | 61 }, |
70 | 62 |
71 /** | 63 /** |
72 * Disables the cancel button and removes its keydown event listener. | 64 * Disables the cancel button and removes its keydown event listener. |
73 */ | 65 */ |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Removing extra spaces from within the string. | 153 // Removing extra spaces from within the string. |
162 html = html.replace(/\s{2,}/g, ' '); | 154 html = html.replace(/\s{2,}/g, ' '); |
163 this.summary_.innerHTML = html; | 155 this.summary_.innerHTML = html; |
164 }, | 156 }, |
165 }; | 157 }; |
166 | 158 |
167 return { | 159 return { |
168 PrintHeader: PrintHeader, | 160 PrintHeader: PrintHeader, |
169 }; | 161 }; |
170 }); | 162 }); |
OLD | NEW |