| 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 #ifndef CHROME_BROWSER_PREFS_PREF_REGISTRY_H_ | 5 #ifndef BASE_PREFS_PREF_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_PREFS_PREF_REGISTRY_H_ | 6 #define BASE_PREFS_PREF_REGISTRY_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/prefs/base_prefs_export.h" |
| 10 #include "base/prefs/pref_value_map.h" | 11 #include "base/prefs/pref_value_map.h" |
| 11 | 12 |
| 12 namespace base { | 13 namespace base { |
| 13 class Value; | 14 class Value; |
| 14 } | 15 } |
| 15 | 16 |
| 16 class DefaultPrefStore; | 17 class DefaultPrefStore; |
| 17 class PrefStore; | 18 class PrefStore; |
| 18 | 19 |
| 19 // Preferences need to be registered with a type and default value | 20 // Preferences need to be registered with a type and default value |
| 20 // before they are used. | 21 // before they are used. |
| 21 // | 22 // |
| 22 // The way you use a PrefRegistry is that you register all required | 23 // The way you use a PrefRegistry is that you register all required |
| 23 // preferences on it (via one of its subclasses), then pass it as a | 24 // preferences on it (via one of its subclasses), then pass it as a |
| 24 // construction parameter to PrefService. | 25 // construction parameter to PrefService. |
| 25 // | 26 // |
| 26 // Currently, registrations after constructing the PrefService will | 27 // Currently, registrations after constructing the PrefService will |
| 27 // also work, but this is being deprecated. | 28 // also work, but this is being deprecated. |
| 28 class PrefRegistry : public base::RefCounted<PrefRegistry> { | 29 class BASE_PREFS_EXPORT PrefRegistry : public base::RefCounted<PrefRegistry> { |
| 29 public: | 30 public: |
| 30 typedef PrefValueMap::const_iterator const_iterator; | 31 typedef PrefValueMap::const_iterator const_iterator; |
| 31 typedef base::Callback<void(const char*, base::Value*)> RegistrationCallback; | 32 typedef base::Callback<void(const char*, base::Value*)> RegistrationCallback; |
| 32 typedef base::Callback<void(const char*)> UnregistrationCallback; | 33 typedef base::Callback<void(const char*)> UnregistrationCallback; |
| 33 | 34 |
| 34 PrefRegistry(); | 35 PrefRegistry(); |
| 35 | 36 |
| 36 // Gets the registered defaults. | 37 // Gets the registered defaults. |
| 37 scoped_refptr<PrefStore> defaults(); | 38 scoped_refptr<PrefStore> defaults(); |
| 38 | 39 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 63 | 64 |
| 64 scoped_refptr<DefaultPrefStore> defaults_; | 65 scoped_refptr<DefaultPrefStore> defaults_; |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 RegistrationCallback registration_callback_; | 68 RegistrationCallback registration_callback_; |
| 68 UnregistrationCallback unregistration_callback_; | 69 UnregistrationCallback unregistration_callback_; |
| 69 | 70 |
| 70 DISALLOW_COPY_AND_ASSIGN(PrefRegistry); | 71 DISALLOW_COPY_AND_ASSIGN(PrefRegistry); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 #endif // CHROME_BROWSER_PREFS_PREF_REGISTRY_H_ | 74 #endif // BASE_PREFS_PREF_REGISTRY_H_ |
| OLD | NEW |