OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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('options', function() { | 5 cr.define('options', function() { |
6 var Preferences = options.Preferences; | 6 var Preferences = options.Preferences; |
7 | 7 |
8 /** | 8 /** |
9 * A controlled setting indicator that can be placed on a setting as an | 9 * A controlled setting indicator that can be placed on a setting as an |
10 * indicator that the value is controlled by some external entity such as | 10 * indicator that the value is controlled by some external entity such as |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 * Open or close a bubble with further information about the pref. | 131 * Open or close a bubble with further information about the pref. |
132 * @private | 132 * @private |
133 */ | 133 */ |
134 toggleBubble_: function() { | 134 toggleBubble_: function() { |
135 if (this.showingBubble) { | 135 if (this.showingBubble) { |
136 OptionsPage.hideBubble(); | 136 OptionsPage.hideBubble(); |
137 } else { | 137 } else { |
138 var self = this; | 138 var self = this; |
139 | 139 |
140 // Construct the bubble text. | 140 // Construct the bubble text. |
141 defaultStrings = { | 141 if (this.hasAttribute('plural')) { |
142 'policy': loadTimeData.getString('controlledSettingPolicy'), | 142 var defaultStrings = { |
143 'extension': loadTimeData.getString('controlledSettingExtension'), | 143 'policy': loadTimeData.getString('controlledSettingsPolicy'), |
144 'recommended': loadTimeData.getString('controlledSettingRecommended'), | 144 'extension': loadTimeData.getString('controlledSettingsExtension'), |
145 'hasRecommendation': | 145 }; |
146 loadTimeData.getString('controlledSettingHasRecommendation'), | 146 } else { |
147 }; | 147 var defaultStrings = { |
| 148 'policy': loadTimeData.getString('controlledSettingPolicy'), |
| 149 'extension': loadTimeData.getString('controlledSettingExtension'), |
| 150 'recommended': |
| 151 loadTimeData.getString('controlledSettingRecommended'), |
| 152 'hasRecommendation': |
| 153 loadTimeData.getString('controlledSettingHasRecommendation'), |
| 154 }; |
| 155 } |
148 | 156 |
149 // No controller, no bubble. | 157 // No controller, no bubble. |
150 if (!this.controlledBy || !(this.controlledBy in defaultStrings)) | 158 if (!this.controlledBy || !(this.controlledBy in defaultStrings)) |
151 return; | 159 return; |
152 | 160 |
153 var text = defaultStrings[this.controlledBy]; | 161 var text = defaultStrings[this.controlledBy]; |
154 | 162 |
155 // Apply text overrides. | 163 // Apply text overrides. |
156 if (this.hasAttribute('text' + this.controlledBy)) | 164 if (this.hasAttribute('text' + this.controlledBy)) |
157 text = this.getAttribute('text' + this.controlledBy); | 165 text = this.getAttribute('text' + this.controlledBy); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 * @type {string} | 230 * @type {string} |
223 */ | 231 */ |
224 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', | 232 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', |
225 cr.PropertyKind.ATTR); | 233 cr.PropertyKind.ATTR); |
226 | 234 |
227 // Export. | 235 // Export. |
228 return { | 236 return { |
229 ControlledSettingIndicator: ControlledSettingIndicator | 237 ControlledSettingIndicator: ControlledSettingIndicator |
230 }; | 238 }; |
231 }); | 239 }); |
OLD | NEW |