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

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

Issue 753603002: Change preference APIs to take std::string instead of const char*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed all calls to c_str() in prefs. Created 6 years 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 | « base/prefs/mock_pref_change_callback.h ('k') | base/prefs/pref_change_registrar.cc » ('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 BASE_PREFS_PREF_CHANGE_REGISTRAR_H_ 5 #ifndef BASE_PREFS_PREF_CHANGE_REGISTRAR_H_
6 #define BASE_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
(...skipping 22 matching lines...) Expand all
33 void Init(PrefService* service); 33 void Init(PrefService* service);
34 34
35 // Adds a pref observer for the specified pref |path| and |obs| observer 35 // Adds a pref observer for the specified pref |path| and |obs| observer
36 // object. All registered observers will be automatically unregistered 36 // object. All registered observers will be automatically unregistered
37 // when the registrar's destructor is called. 37 // when the registrar's destructor is called.
38 // 38 //
39 // The second version binds a callback that will receive the path of 39 // The second version binds a callback that will receive the path of
40 // the preference that is changing as its parameter. 40 // the preference that is changing as its parameter.
41 // 41 //
42 // Only one observer may be registered per path. 42 // Only one observer may be registered per path.
43 void Add(const char* path, const base::Closure& obs); 43 void Add(const std::string& path, const base::Closure& obs);
44 void Add(const char* path, const NamedChangeCallback& obs); 44 void Add(const std::string& path, const NamedChangeCallback& obs);
45 45
46 // Removes the pref observer registered for |path|. 46 // Removes the pref observer registered for |path|.
47 void Remove(const char* path); 47 void Remove(const std::string& path);
48 48
49 // Removes all observers that have been previously added with a call to Add. 49 // Removes all observers that have been previously added with a call to Add.
50 void RemoveAll(); 50 void RemoveAll();
51 51
52 // Returns true if no pref observers are registered. 52 // Returns true if no pref observers are registered.
53 bool IsEmpty() const; 53 bool IsEmpty() const;
54 54
55 // Check whether |pref| is in the set of preferences being observed. 55 // Check whether |pref| is in the set of preferences being observed.
56 bool IsObserved(const std::string& pref); 56 bool IsObserved(const std::string& pref);
57 57
(...skipping 14 matching lines...) Expand all
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 // BASE_PREFS_PREF_CHANGE_REGISTRAR_H_ 81 #endif // BASE_PREFS_PREF_CHANGE_REGISTRAR_H_
OLDNEW
« no previous file with comments | « base/prefs/mock_pref_change_callback.h ('k') | base/prefs/pref_change_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698