pref_registry_simple.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PREFS_PREF_REGISTRY_SIMPLE_H_
  5. #define COMPONENTS_PREFS_PREF_REGISTRY_SIMPLE_H_
  6. #include <stdint.h>
  7. #include <memory>
  8. #include <string>
  9. #include "base/time/time.h"
  10. #include "base/values.h"
  11. #include "components/prefs/pref_registry.h"
  12. #include "components/prefs/prefs_export.h"
  13. namespace base {
  14. class FilePath;
  15. }
  16. // A simple implementation of PrefRegistry.
  17. class COMPONENTS_PREFS_EXPORT PrefRegistrySimple : public PrefRegistry {
  18. public:
  19. PrefRegistrySimple();
  20. PrefRegistrySimple(const PrefRegistrySimple&) = delete;
  21. PrefRegistrySimple& operator=(const PrefRegistrySimple&) = delete;
  22. // For each of these registration methods, |flags| is an optional bitmask of
  23. // PrefRegistrationFlags.
  24. void RegisterBooleanPref(const std::string& path,
  25. bool default_value,
  26. uint32_t flags = NO_REGISTRATION_FLAGS);
  27. void RegisterIntegerPref(const std::string& path,
  28. int default_value,
  29. uint32_t flags = NO_REGISTRATION_FLAGS);
  30. void RegisterDoublePref(const std::string& path,
  31. double default_value,
  32. uint32_t flags = NO_REGISTRATION_FLAGS);
  33. void RegisterStringPref(const std::string& path,
  34. const std::string& default_value,
  35. uint32_t flags = NO_REGISTRATION_FLAGS);
  36. void RegisterFilePathPref(const std::string& path,
  37. const base::FilePath& default_value,
  38. uint32_t flags = NO_REGISTRATION_FLAGS);
  39. void RegisterListPref(const std::string& path,
  40. uint32_t flags = NO_REGISTRATION_FLAGS);
  41. void RegisterListPref(const std::string& path,
  42. base::Value default_value,
  43. uint32_t flags = NO_REGISTRATION_FLAGS);
  44. void RegisterListPref(const std::string& path,
  45. base::Value::List default_value,
  46. uint32_t flags = NO_REGISTRATION_FLAGS);
  47. void RegisterDictionaryPref(const std::string& path,
  48. uint32_t flags = NO_REGISTRATION_FLAGS);
  49. void RegisterDictionaryPref(const std::string& path,
  50. base::Value default_value,
  51. uint32_t flags = NO_REGISTRATION_FLAGS);
  52. void RegisterDictionaryPref(const std::string& path,
  53. base::Value::Dict default_value,
  54. uint32_t flags = NO_REGISTRATION_FLAGS);
  55. void RegisterInt64Pref(const std::string& path,
  56. int64_t default_value,
  57. uint32_t flags = NO_REGISTRATION_FLAGS);
  58. void RegisterUint64Pref(const std::string& path,
  59. uint64_t default_value,
  60. uint32_t flags = NO_REGISTRATION_FLAGS);
  61. void RegisterTimePref(const std::string& path,
  62. base::Time default_value,
  63. uint32_t flags = NO_REGISTRATION_FLAGS);
  64. void RegisterTimeDeltaPref(const std::string& path,
  65. base::TimeDelta default_value,
  66. uint32_t flags = NO_REGISTRATION_FLAGS);
  67. protected:
  68. ~PrefRegistrySimple() override;
  69. };
  70. #endif // COMPONENTS_PREFS_PREF_REGISTRY_SIMPLE_H_