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 | 6 |
7 ///////////////////////////////////////////////////////////////////////////// | 7 ///////////////////////////////////////////////////////////////////////////// |
8 // Preferences class: | 8 // Preferences class: |
9 | 9 |
10 /** | 10 /** |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 * @private | 207 * @private |
208 */ | 208 */ |
209 setPrefNoCommit_: function(name, type, value) { | 209 setPrefNoCommit_: function(name, type, value) { |
210 var pref = this.registeredPreferences_[name]; | 210 var pref = this.registeredPreferences_[name]; |
211 pref.action = 'set'; | 211 pref.action = 'set'; |
212 pref.type = type; | 212 pref.type = type; |
213 pref.value = value; | 213 pref.value = value; |
214 | 214 |
215 var event = new Event(name); | 215 var event = new Event(name); |
216 // Decorate pref value as CoreOptionsHandler::CreateValueForPref() does. | 216 // Decorate pref value as CoreOptionsHandler::CreateValueForPref() does. |
217 event.value = { | 217 event.value = {value: value, uncommitted: true}; |
218 value: value, | 218 if (pref.orig) { |
219 recommendedValue: pref.orig.recommendedValue, | 219 event.value.recommendedValue = pref.orig.recommendedValue; |
220 disabled: pref.orig.disabled, | 220 event.value.disabled = pref.orig.disabled; |
221 uncommitted: true, | 221 } |
222 }; | |
223 this.dispatchEvent(event); | 222 this.dispatchEvent(event); |
224 }, | 223 }, |
225 | 224 |
226 /** | 225 /** |
227 * Clears a preference and signals its new value. The change is propagated | 226 * Clears a preference and signals its new value. The change is propagated |
228 * throughout the UI code but is not committed to Chrome yet. | 227 * throughout the UI code but is not committed to Chrome yet. |
229 * @param {string} name Preference name. | 228 * @param {string} name Preference name. |
230 * @private | 229 * @private |
231 */ | 230 */ |
232 clearPrefNoCommit_: function(name) { | 231 clearPrefNoCommit_: function(name) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 prefs.registeredPreferences_[notification[0]] = {orig: notification[1]}; | 328 prefs.registeredPreferences_[notification[0]] = {orig: notification[1]}; |
330 prefs.dispatchEvent(event); | 329 prefs.dispatchEvent(event); |
331 }; | 330 }; |
332 | 331 |
333 // Export | 332 // Export |
334 return { | 333 return { |
335 Preferences: Preferences | 334 Preferences: Preferences |
336 }; | 335 }; |
337 | 336 |
338 }); | 337 }); |
OLD | NEW |