OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/prefs/pref_registry.h" | |
6 | |
7 #include "chrome/browser/prefs/pref_service.h" | |
8 | |
9 PrefRegistry::PrefRegistry() | |
10 : pref_service_(NULL), | |
11 default_prefs_(new DefaultPrefStore()) { | |
12 } | |
13 | |
14 void PrefRegistry::DeprecatedUnregisterPreference(const char* path) { | |
15 DCHECK(pref_service_); | |
16 if (pref_service_) | |
17 pref_service_->UnregisterPreference(path); | |
Mattias Nissler (ping if slow)
2013/01/25 14:57:11
I'd rather not call into pref_service and back. Gi
Jói
2013/01/29 16:10:02
This needs to stay here (and be virtual) since Pre
| |
18 } | |
19 | |
20 void PrefRegistry::RetrieveDefaults(scoped_refptr<DefaultPrefStore>* result) { | |
21 result->swap(default_prefs_); // This releases the member reference. | |
Mattias Nissler (ping if slow)
2013/01/25 14:57:11
Why would we want to release the pointer here?
Jói
2013/01/29 16:10:02
This was meant as a belt-and-suspenders approach t
| |
22 } | |
23 | |
24 void PrefRegistry::RegisterPreference(const char* path, | |
25 base::Value* default_value) { | |
26 if (pref_service_) { | |
27 pref_service_->RegisterPreference(path, default_value, false); | |
28 } else { | |
29 default_prefs_->SetDefaultValue(path, default_value); | |
30 } | |
Mattias Nissler (ping if slow)
2013/01/25 14:57:11
It seems like instead of sometimes delegating to P
Jói
2013/01/29 16:10:02
Done, but PrefService still gets callbacks to upda
| |
31 } | |
OLD | NEW |