summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prefs/pref_service.h
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 17:24:18 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 17:24:18 +0000
commita6a7ced56b518de42dab6d3ac18de490fb494696 (patch)
treeb89d63fe26927a79e9d6d07519fa1983a5466f5a /chrome/browser/prefs/pref_service.h
parent38d455b3bc1ab2a7b9efc58d78c7ba9ec5067001 (diff)
downloadchromium_src-a6a7ced56b518de42dab6d3ac18de490fb494696.zip
chromium_src-a6a7ced56b518de42dab6d3ac18de490fb494696.tar.gz
chromium_src-a6a7ced56b518de42dab6d3ac18de490fb494696.tar.bz2
Remove content::NotificationObserver dependency from most Prefs code.
Instead of using content::NotificationObserver, introduce specific type-safe observer classes and update users to use them. In a very large number of cases this was the users' only reason for being a content::NotificationObserver and they would have a lot of boiler-plate code such as a DCHECK on the notification type and unpacking of the generic NotificationDetails types, so this change removes a bunch of boilerplate and introduces more type safety. This is part of enabling more of the Prefs code to live in base/prefs/. TBR=ben@chromium.org,brettw@chromium.org BUG=155525 Review URL: https://chromiumcodereview.appspot.com/11345008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prefs/pref_service.h')
-rw-r--r--chrome/browser/prefs/pref_service.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h
index c855ef1..1536b95 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -14,6 +14,7 @@
#include <set>
#include <string>
+#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/hash_tables.h"
@@ -27,6 +28,7 @@ class PersistentPrefStore;
class PrefModelAssociator;
class PrefNotifier;
class PrefNotifierImpl;
+class PrefObserver;
class PrefServiceObserver;
class PrefStore;
class PrefValueStore;
@@ -277,6 +279,11 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// Do not call this after having derived an incognito or per tab pref service.
void UpdateCommandLinePrefStore(CommandLine* command_line);
+ // We run the callback once, when initialization completes. The bool
+ // parameter will be set to true for successful initialization,
+ // false for unsuccessful.
+ void AddPrefInitObserver(base::Callback<void(bool)> callback);
+
protected:
// Construct a new pref service. This constructor is what
// factory methods end up calling and what is used for unit tests.
@@ -306,9 +313,9 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// PrefServiceBase implementation (protected in base, private here).
virtual void AddPrefObserver(const char* path,
- content::NotificationObserver* obs) OVERRIDE;
+ PrefObserver* obs) OVERRIDE;
virtual void RemovePrefObserver(const char* path,
- content::NotificationObserver* obs) OVERRIDE;
+ PrefObserver* obs) OVERRIDE;
// Sends notification of a changed preference. This needs to be called by
// a ScopedUserPrefUpdate if a DictionaryValue or ListValue is changed.