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

Side by Side Diff: components/prefs/pref_change_registrar.h

Issue 1662843002: Revert of Delete base/prefs and update callers to use components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « components/prefs/persistent_pref_store.h ('k') | components/prefs/pref_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef COMPONENTS_PREFS_PREF_CHANGE_REGISTRAR_H_ 5 #ifndef BASE_PREFS_PREF_CHANGE_REGISTRAR_H_
6 #define COMPONENTS_PREFS_PREF_CHANGE_REGISTRAR_H_ 6 #define BASE_PREFS_PREF_CHANGE_REGISTRAR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/prefs/base_prefs_export.h" 13 #include "components/prefs/base_prefs_export.h"
14 #include "components/prefs/pref_observer.h" 14 #include "components/prefs/pref_observer.h"
15 15
16 class PrefService; 16 class PrefService;
17 17
18 // Automatically manages the registration of one or more pref change observers 18 // Automatically manages the registration of one or more pref change observers
19 // with a PrefStore. Functions much like NotificationRegistrar, but specifically 19 // with a PrefStore. Functions much like NotificationRegistrar, but specifically
20 // manages observers of preference changes. When the Registrar is destroyed, 20 // manages observers of preference changes. When the Registrar is destroyed,
21 // all registered observers are automatically unregistered with the PrefStore. 21 // all registered observers are automatically unregistered with the PrefStore.
22 class COMPONENTS_PREFS_EXPORT PrefChangeRegistrar : public PrefObserver { 22 class BASE_PREFS_EXPORT PrefChangeRegistrar : public PrefObserver {
23 public: 23 public:
24 // You can register this type of callback if you need to know the 24 // You can register this type of callback if you need to know the
25 // path of the preference that is changing. 25 // path of the preference that is changing.
26 typedef base::Callback<void(const std::string&)> NamedChangeCallback; 26 typedef base::Callback<void(const std::string&)> NamedChangeCallback;
27 27
28 PrefChangeRegistrar(); 28 PrefChangeRegistrar();
29 virtual ~PrefChangeRegistrar(); 29 virtual ~PrefChangeRegistrar();
30 30
31 // Must be called before adding or removing observers. Can be called more 31 // Must be called before adding or removing observers. Can be called more
32 // than once as long as the value of |service| doesn't change. 32 // than once as long as the value of |service| doesn't change.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const std::string& pref_name); 71 const std::string& pref_name);
72 72
73 typedef std::map<std::string, NamedChangeCallback> ObserverMap; 73 typedef std::map<std::string, NamedChangeCallback> ObserverMap;
74 74
75 ObserverMap observers_; 75 ObserverMap observers_;
76 PrefService* service_; 76 PrefService* service_;
77 77
78 DISALLOW_COPY_AND_ASSIGN(PrefChangeRegistrar); 78 DISALLOW_COPY_AND_ASSIGN(PrefChangeRegistrar);
79 }; 79 };
80 80
81 #endif // COMPONENTS_PREFS_PREF_CHANGE_REGISTRAR_H_ 81 #endif // BASE_PREFS_PREF_CHANGE_REGISTRAR_H_
OLDNEW
« no previous file with comments | « components/prefs/persistent_pref_store.h ('k') | components/prefs/pref_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698