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 30 matching lines...) Expand all Loading... | |
41 */ | 41 */ |
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() { |
kmadhusu
2011/08/08 22:20:45
How about:
this.landscapeRadioButton_.onclick = th
dpapad
2011/08/08 23:41:43
Done.
| |
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 12 matching lines...) Expand all Loading... | |
80 if (printSettings.isLandscape == this.isLandscape()) | 78 if (printSettings.isLandscape == this.isLandscape()) |
81 return; | 79 return; |
82 setDefaultValuesAndRegeneratePreview(); | 80 setDefaultValuesAndRegeneratePreview(); |
83 }, | 81 }, |
84 | 82 |
85 /** | 83 /** |
86 * Listener executing when a PDFLoaded event occurs. | 84 * Listener executing when a PDFLoaded event occurs. |
87 * @private | 85 * @private |
88 */ | 86 */ |
89 onPDFLoaded_: function() { | 87 onPDFLoaded_: function() { |
90 if (!previewModifiable) | 88 this.fadeInOut_(!previewModifiable); |
91 fadeOutElement(this.layoutOption_); | |
92 }, | 89 }, |
93 | 90 |
94 /** | 91 /** |
95 * @param {boolean} fadeOut True if |this.layoutOption_| should be faded | 92 * @param {boolean} fadeOut True if |this.layoutOption_| should be faded |
96 * out, false if it should be faded in. | 93 * out, false if it should be faded in. |
97 * @private | 94 * @private |
98 */ | 95 */ |
99 fadeInOut_: function(fadeOut) { | 96 fadeInOut_: function(fadeOut) { |
100 fadeOut ? fadeOutElement(this.layoutOption_) : | 97 fadeOut ? fadeOutElement(this.layoutOption_) : |
101 fadeInElement(this.layoutOption_); | 98 fadeInElement(this.layoutOption_); |
102 } | 99 } |
103 }; | 100 }; |
104 | 101 |
105 return { | 102 return { |
106 LayoutSettings: LayoutSettings, | 103 LayoutSettings: LayoutSettings, |
107 }; | 104 }; |
108 }); | 105 }); |
OLD | NEW |