Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(757)

Unified Diff: chrome/browser/prefs/pref_service.h

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/pref_service.h
diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h
index ff57a72d6bccf928ac2da3e2567f37e67db8a0a1..5d8126eaa4ec3c67c4e3992f61da3f72df7568b1 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -15,9 +15,9 @@
#include <string>
#include "base/callback.h"
+#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/hash_tables.h"
#include "base/observer_list.h"
#include "base/prefs/persistent_pref_store.h"
#include "base/prefs/public/pref_service_base.h"
@@ -36,7 +36,7 @@ class ScopedUserPrefUpdateBase;
// Base class for PrefServices. You can use the base class to read and
// interact with preferences, but not to register new preferences; for
-// that see subclasses like PrefServiceSimple.
+// that see e.g. PrefRegistrarSimple.
class PrefService : public PrefServiceBase, public base::NonThreadSafe {
public:
enum PrefInitializationStatus {
@@ -112,7 +112,6 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// PrefServiceBase implementation.
virtual bool IsManagedPreference(const char* pref_name) const OVERRIDE;
virtual bool IsUserModifiablePreference(const char* pref_name) const OVERRIDE;
- virtual void UnregisterPreference(const char* path) OVERRIDE;
virtual const PrefService::Preference* FindPreference(
const char* path) const OVERRIDE;
virtual bool GetBoolean(const char* path) const OVERRIDE;
@@ -167,12 +166,23 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
void AddPrefInitObserver(base::Callback<void(bool)> callback);
protected:
+ friend class PrefRegistrarSimple;
+
// Registers a new preference at |path|. The |default_value| must not be
// NULL as it determines the preference value's type.
// RegisterPreference must not be called twice for the same path.
// This method takes ownership of |default_value|.
void RegisterPreference(const char* path, base::Value* default_value);
+ void UnregisterPreference(const char* path);
+
+ // Subclasses should override this to return false if they do not
+ // wish to allow PrefRegistrarSimple to be used to register
+ // preferences on this object, e.g. if they wish to ensure more
+ // parameters are given for each registration than
+ // PrefRegistrarSimple takes.
+ virtual bool AllowPrefRegistrarSimple() const;
+
// The PrefNotifier handles registering and notifying preference observers.
// It is created and owned by this PrefService. Subclasses may access it for
// unit testing.
@@ -196,9 +206,6 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// vs. std::map, and by roughly 180ms vs. std::set of Preference pointers.
typedef base::hash_map<std::string, Preference> PreferenceMap;
- // Give access to Initialize().
- friend class PrefServiceBuilder;
-
// Give access to ReportUserPrefChanged() and GetMutableUserPref().
friend class subtle::ScopedUserPrefUpdateBase;
@@ -248,7 +255,6 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// TODO(joi): Remove these forwards. They were placed here temporarily
// to limit the size of the initial change that split
// PrefServiceSimple and PrefServiceSyncable out of PrefService.
-#include "chrome/browser/prefs/pref_service_simple.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698