OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A helper class that stays in sync with a preference (bool, int, real, | 5 // A helper class that stays in sync with a preference (bool, int, real, |
6 // string or filepath). For example: | 6 // string or filepath). For example: |
7 // | 7 // |
8 // class MyClass { | 8 // class MyClass { |
9 // public: | 9 // public: |
10 // MyClass(PrefService* prefs) { | 10 // MyClass(PrefService* prefs) { |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "base/memory/ref_counted.h" | 35 #include "base/memory/ref_counted.h" |
36 #include "base/message_loop_proxy.h" | 36 #include "base/message_loop_proxy.h" |
37 #include "base/prefs/base_prefs_export.h" | 37 #include "base/prefs/base_prefs_export.h" |
38 #include "base/prefs/pref_observer.h" | 38 #include "base/prefs/pref_observer.h" |
39 #include "base/values.h" | 39 #include "base/values.h" |
40 | 40 |
41 class PrefServiceBase; | 41 class PrefServiceBase; |
42 | 42 |
43 namespace subtle { | 43 namespace subtle { |
44 | 44 |
45 class BASE_PREFS_EXPORT PrefMemberBase | 45 class BASE_PREFS_EXPORT PrefMemberBase : public PrefObserver { |
46 : public NON_EXPORTED_BASE(PrefObserver) { | |
47 public: | 46 public: |
48 // Type of callback you can register if you need to know the name of | 47 // Type of callback you can register if you need to know the name of |
49 // the pref that is changing. | 48 // the pref that is changing. |
50 typedef base::Callback<void(const std::string&)> NamedChangeCallback; | 49 typedef base::Callback<void(const std::string&)> NamedChangeCallback; |
51 | 50 |
52 PrefServiceBase* prefs() { return prefs_; } | 51 PrefServiceBase* prefs() { return prefs_; } |
53 const PrefServiceBase* prefs() const { return prefs_; } | 52 const PrefServiceBase* prefs() const { return prefs_; } |
54 | 53 |
55 protected: | 54 protected: |
56 class BASE_PREFS_EXPORT Internal | 55 class BASE_PREFS_EXPORT Internal |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 343 |
345 typedef PrefMember<bool> BooleanPrefMember; | 344 typedef PrefMember<bool> BooleanPrefMember; |
346 typedef PrefMember<int> IntegerPrefMember; | 345 typedef PrefMember<int> IntegerPrefMember; |
347 typedef PrefMember<double> DoublePrefMember; | 346 typedef PrefMember<double> DoublePrefMember; |
348 typedef PrefMember<std::string> StringPrefMember; | 347 typedef PrefMember<std::string> StringPrefMember; |
349 typedef PrefMember<FilePath> FilePathPrefMember; | 348 typedef PrefMember<FilePath> FilePathPrefMember; |
350 // This preference member is expensive for large string arrays. | 349 // This preference member is expensive for large string arrays. |
351 typedef PrefMember<std::vector<std::string> > StringListPrefMember; | 350 typedef PrefMember<std::vector<std::string> > StringListPrefMember; |
352 | 351 |
353 #endif // BASE_PREFS_PUBLIC_PREF_MEMBER_H_ | 352 #endif // BASE_PREFS_PUBLIC_PREF_MEMBER_H_ |
OLD | NEW |