Chromium Code Reviews| Index: chrome/browser/prefs/pref_registry.cc |
| diff --git a/chrome/browser/prefs/pref_registry.cc b/chrome/browser/prefs/pref_registry.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..26b738b2fefb47e20019d3ff4ef94afc141d47bf |
| --- /dev/null |
| +++ b/chrome/browser/prefs/pref_registry.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/prefs/pref_registry.h" |
| + |
| +#include "chrome/browser/prefs/pref_service.h" |
| + |
| +PrefRegistry::PrefRegistry() |
| + : pref_service_(NULL), |
| + default_prefs_(new DefaultPrefStore()) { |
| +} |
| + |
| +void PrefRegistry::DeprecatedUnregisterPreference(const char* path) { |
| + DCHECK(pref_service_); |
| + if (pref_service_) |
| + 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
|
| +} |
| + |
| +void PrefRegistry::RetrieveDefaults(scoped_refptr<DefaultPrefStore>* result) { |
| + 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
|
| +} |
| + |
| +void PrefRegistry::RegisterPreference(const char* path, |
| + base::Value* default_value) { |
| + if (pref_service_) { |
| + pref_service_->RegisterPreference(path, default_value, false); |
| + } else { |
| + default_prefs_->SetDefaultValue(path, default_value); |
| + } |
|
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
|
| +} |