Chromium Code Reviews| 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 MarginSettings object. This object encapsulates all settings and | 9 * Creates a MarginSettings object. This object encapsulates all settings and |
| 10 * logic related to the margins mode. | 10 * logic related to the margins mode. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 /** | 54 /** |
| 55 * Gets the value of the selected margin option. | 55 * Gets the value of the selected margin option. |
| 56 * @private | 56 * @private |
| 57 * @return {number} | 57 * @return {number} |
| 58 */ | 58 */ |
| 59 get selectedMarginsValue_() { | 59 get selectedMarginsValue_() { |
| 60 return this.marginList_.options[this.marginList_.selectedIndex].value; | 60 return this.marginList_.options[this.marginList_.selectedIndex].value; |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Checks whether user has selected the Default Margins option or not. | 64 * Gets the string representation of the margin type selected. |
| 65 * | 65 * |
| 66 * @return {boolean} true if default margins are selected. | 66 * @return {string} |
| 67 */ | 67 */ |
| 68 isDefaultMarginsSelected: function() { | 68 get marginTypeString() { |
| 69 return this.selectedMarginsValue_ == this.defaultMarginsValue_; | 69 if (this.selectedMarginsValue_ == this.noMarginsValue_) |
|
dpapad
2011/10/12 15:59:05
After landing http://codereview.chromium.org/78910
vandebo (ex-Chrome)
2011/10/12 17:32:49
Agreed. Done.
| |
| 70 return "noMargins"; | |
| 71 else if (this.selectedMarginsValue_ == this.customMarginsValue_) | |
| 72 return "customMargins"; | |
| 73 else | |
| 74 return "defaultMargins"; | |
| 70 }, | 75 }, |
| 71 | 76 |
| 72 /** | 77 /** |
| 73 * Adds listeners to all margin related controls. The listeners take care | 78 * Adds listeners to all margin related controls. The listeners take care |
| 74 * of altering their behavior depending on |hasPendingPreviewRequest|. | 79 * of altering their behavior depending on |hasPendingPreviewRequest|. |
| 75 */ | 80 */ |
| 76 addEventListeners: function() { | 81 addEventListeners: function() { |
| 77 this.marginList_.onchange = this.onMarginsChanged_.bind(this); | 82 this.marginList_.onchange = this.onMarginsChanged_.bind(this); |
| 78 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this)); | 83 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this)); |
| 79 }, | 84 }, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 onPDFLoaded_: function() { | 117 onPDFLoaded_: function() { |
| 113 if (!previewModifiable) | 118 if (!previewModifiable) |
| 114 fadeOutElement(this.marginsOption_); | 119 fadeOutElement(this.marginsOption_); |
| 115 } | 120 } |
| 116 }; | 121 }; |
| 117 | 122 |
| 118 return { | 123 return { |
| 119 MarginSettings: MarginSettings, | 124 MarginSettings: MarginSettings, |
| 120 }; | 125 }; |
| 121 }); | 126 }); |
| OLD | NEW |