| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 this.printButton_.onclick = this.onPrintButtonClicked_.bind(this); | 44 this.printButton_.onclick = this.onPrintButtonClicked_.bind(this); |
| 45 document.addEventListener('updateSummary', | 45 document.addEventListener('updateSummary', |
| 46 this.updateSummary_.bind(this)); | 46 this.updateSummary_.bind(this)); |
| 47 document.addEventListener('updatePrintButton', | 47 document.addEventListener('updatePrintButton', |
| 48 this.updatePrintButton_.bind(this)); | 48 this.updatePrintButton_.bind(this)); |
| 49 document.addEventListener('disableCancelButton', | 49 document.addEventListener('disableCancelButton', |
| 50 this.disableCancelButton.bind(this)); | 50 this.disableCancelButton.bind(this)); |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Enables the cancel button and attaches its keydown event listener. |
| 55 */ |
| 56 enableCancelButton: function() { |
| 57 window.onkeydown = onKeyDown; |
| 58 this.cancelButton_.disabled = false; |
| 59 }, |
| 60 |
| 61 /** |
| 54 * Disables the cancel button and removes its keydown event listener. | 62 * Disables the cancel button and removes its keydown event listener. |
| 55 */ | 63 */ |
| 56 disableCancelButton: function() { | 64 disableCancelButton: function() { |
| 57 window.onkeydown = null; | 65 window.onkeydown = null; |
| 58 this.cancelButton_.disabled = true; | 66 this.cancelButton_.disabled = true; |
| 59 }, | 67 }, |
| 60 | 68 |
| 61 /** | 69 /** |
| 62 * Listener executing whenever |this.printButton_| is clicked. | 70 * Listener executing whenever |this.printButton_| is clicked. |
| 63 * @private | 71 * @private |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Removing extra spaces from within the string. | 148 // Removing extra spaces from within the string. |
| 141 html = html.replace(/\s{2,}/g, ' '); | 149 html = html.replace(/\s{2,}/g, ' '); |
| 142 this.summary_.innerHTML = html; | 150 this.summary_.innerHTML = html; |
| 143 }, | 151 }, |
| 144 }; | 152 }; |
| 145 | 153 |
| 146 return { | 154 return { |
| 147 PrintHeader: PrintHeader, | 155 PrintHeader: PrintHeader, |
| 148 }; | 156 }; |
| 149 }); | 157 }); |
| OLD | NEW |