Chromium Code Reviews| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 = { |
| 218 value: value, | 218 value: value, |
| 219 recommendedValue: pref.orig.recommendedValue, | 219 recommendedValue: pref.orig ? pref.orig.recommendedValue : undefined, |
| 220 disabled: pref.orig.disabled, | 220 disabled: pref.orig ? pref.orig.disabled : undefined, |
| 221 uncommitted: true, | 221 uncommitted: true, |
| 222 }; | 222 }; |
|
Dan Beam
2014/03/27 21:06:43
nit:
event.value = {value: value, uncommitted: tr
rpetterson
2014/03/27 21:26:00
Done.
| |
| 223 this.dispatchEvent(event); | 223 this.dispatchEvent(event); |
| 224 }, | 224 }, |
| 225 | 225 |
| 226 /** | 226 /** |
| 227 * Clears a preference and signals its new value. The change is propagated | 227 * Clears a preference and signals its new value. The change is propagated |
| 228 * throughout the UI code but is not committed to Chrome yet. | 228 * throughout the UI code but is not committed to Chrome yet. |
| 229 * @param {string} name Preference name. | 229 * @param {string} name Preference name. |
| 230 * @private | 230 * @private |
| 231 */ | 231 */ |
| 232 clearPrefNoCommit_: function(name) { | 232 clearPrefNoCommit_: function(name) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 prefs.registeredPreferences_[notification[0]] = {orig: notification[1]}; | 329 prefs.registeredPreferences_[notification[0]] = {orig: notification[1]}; |
| 330 prefs.dispatchEvent(event); | 330 prefs.dispatchEvent(event); |
| 331 }; | 331 }; |
| 332 | 332 |
| 333 // Export | 333 // Export |
| 334 return { | 334 return { |
| 335 Preferences: Preferences | 335 Preferences: Preferences |
| 336 }; | 336 }; |
| 337 | 337 |
| 338 }); | 338 }); |
| OLD | NEW |