| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 NotificationObserver* observer); | 85 NotificationObserver* observer); |
| 86 | 86 |
| 87 virtual void CreateInternal() const = 0; | 87 virtual void CreateInternal() const = 0; |
| 88 | 88 |
| 89 // See PrefMember<> for description. | 89 // See PrefMember<> for description. |
| 90 void Destroy(); | 90 void Destroy(); |
| 91 | 91 |
| 92 void MoveToThread(BrowserThread::ID thread_id); | 92 void MoveToThread(BrowserThread::ID thread_id); |
| 93 | 93 |
| 94 // NotificationObserver | 94 // NotificationObserver |
| 95 virtual void Observe(NotificationType type, | 95 virtual void Observe(int type, |
| 96 const NotificationSource& source, | 96 const NotificationSource& source, |
| 97 const NotificationDetails& details); | 97 const NotificationDetails& details); |
| 98 | 98 |
| 99 void VerifyValuePrefName() const { | 99 void VerifyValuePrefName() const { |
| 100 DCHECK(!pref_name_.empty()); | 100 DCHECK(!pref_name_.empty()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 // This method is used to do the actual sync with the preference. | 103 // This method is used to do the actual sync with the preference. |
| 104 // Note: it is logically const, because it doesn't modify the state | 104 // Note: it is logically const, because it doesn't modify the state |
| 105 // seen by the outside world. It is just doing a lazy load behind the scenes. | 105 // seen by the outside world. It is just doing a lazy load behind the scenes. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 DISALLOW_COPY_AND_ASSIGN(PrefMember); | 239 DISALLOW_COPY_AND_ASSIGN(PrefMember); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 typedef PrefMember<bool> BooleanPrefMember; | 242 typedef PrefMember<bool> BooleanPrefMember; |
| 243 typedef PrefMember<int> IntegerPrefMember; | 243 typedef PrefMember<int> IntegerPrefMember; |
| 244 typedef PrefMember<double> DoublePrefMember; | 244 typedef PrefMember<double> DoublePrefMember; |
| 245 typedef PrefMember<std::string> StringPrefMember; | 245 typedef PrefMember<std::string> StringPrefMember; |
| 246 typedef PrefMember<FilePath> FilePathPrefMember; | 246 typedef PrefMember<FilePath> FilePathPrefMember; |
| 247 | 247 |
| 248 #endif // CHROME_BROWSER_PREFS_PREF_MEMBER_H_ | 248 #endif // CHROME_BROWSER_PREFS_PREF_MEMBER_H_ |
| OLD | NEW |