| 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 LayoutSettings object. This object encapsulates all settings and | 9 * Creates a LayoutSettings object. This object encapsulates all settings and |
| 10 * logic related to layout mode (portrait/landscape). | 10 * logic related to layout mode (portrait/landscape). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 isLandscape: function() { | 42 isLandscape: function() { |
| 43 return this.landscapeRadioButton_.checked; | 43 return this.landscapeRadioButton_.checked; |
| 44 }, | 44 }, |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Adding listeners to all layout related controls. The listeners take care | 47 * Adding listeners to all layout related controls. The listeners take care |
| 48 * of altering their behavior depending on |hasPendingPreviewRequest|. | 48 * of altering their behavior depending on |hasPendingPreviewRequest|. |
| 49 */ | 49 */ |
| 50 addEventListeners: function() { | 50 addEventListeners: function() { |
| 51 this.landscapeRadioButton_.onclick = function() { | 51 this.landscapeRadioButton_.onclick = function() { |
| 52 if (!hasPendingPreviewRequest) | 52 this.onLayoutButtonClick_(); |
| 53 this.onLayoutButtonClick_(); | |
| 54 }.bind(this); | 53 }.bind(this); |
| 55 this.portraitRadioButton_.onclick = function() { | 54 this.portraitRadioButton_.onclick = function() { |
| 56 if (!hasPendingPreviewRequest) | 55 this.onLayoutButtonClick_(); |
| 57 this.onLayoutButtonClick_(); | |
| 58 }.bind(this); | 56 }.bind(this); |
| 59 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this)); | 57 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this)); |
| 60 document.addEventListener('printerCapabilitiesUpdated', | 58 document.addEventListener('printerCapabilitiesUpdated', |
| 61 this.onPrinterCapabilitiesUpdated_.bind(this)); | 59 this.onPrinterCapabilitiesUpdated_.bind(this)); |
| 62 }, | 60 }, |
| 63 | 61 |
| 64 /** | 62 /** |
| 65 * Listener triggered when a printerCapabilitiesUpdated event occurs. | 63 * Listener triggered when a printerCapabilitiesUpdated event occurs. |
| 66 * @private | 64 * @private |
| 67 */ | 65 */ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 fadeInOut_: function(fadeOut) { | 97 fadeInOut_: function(fadeOut) { |
| 100 fadeOut ? fadeOutElement(this.layoutOption_) : | 98 fadeOut ? fadeOutElement(this.layoutOption_) : |
| 101 fadeInElement(this.layoutOption_); | 99 fadeInElement(this.layoutOption_); |
| 102 } | 100 } |
| 103 }; | 101 }; |
| 104 | 102 |
| 105 return { | 103 return { |
| 106 LayoutSettings: LayoutSettings, | 104 LayoutSettings: LayoutSettings, |
| 107 }; | 105 }; |
| 108 }); | 106 }); |
| OLD | NEW |