Chromium Code Reviews| 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 COMPONENTS_PREFS_PREF_STORE_H_ | 5 #ifndef COMPONENTS_PREFS_PREF_STORE_H_ |
| 6 #define COMPONENTS_PREFS_PREF_STORE_H_ | 6 #define COMPONENTS_PREFS_PREF_STORE_H_ |
| 7 | 7 |
| 8 #include <memory> | |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "components/prefs/base_prefs_export.h" | 13 #include "components/prefs/base_prefs_export.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 16 class DictionaryValue; | |
| 15 class Value; | 17 class Value; |
| 16 } | 18 } |
| 17 | 19 |
| 18 // This is an abstract interface for reading and writing from/to a persistent | 20 // This is an abstract interface for reading and writing from/to a persistent |
| 19 // preference store, used by PrefService. An implementation using a JSON file | 21 // preference store, used by PrefService. An implementation using a JSON file |
| 20 // can be found in JsonPrefStore, while an implementation without any backing | 22 // can be found in JsonPrefStore, while an implementation without any backing |
| 21 // store for testing can be found in TestingPrefStore. Furthermore, there is | 23 // store for testing can be found in TestingPrefStore. Furthermore, there is |
| 22 // CommandLinePrefStore, which bridges command line options to preferences and | 24 // CommandLinePrefStore, which bridges command line options to preferences and |
| 23 // ConfigurationPolicyPrefStore, which is used for hooking up configuration | 25 // ConfigurationPolicyPrefStore, which is used for hooking up configuration |
| 24 // policy with the preference subsystem. | 26 // policy with the preference subsystem. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 45 | 47 |
| 46 // Whether the store has completed all asynchronous initialization. | 48 // Whether the store has completed all asynchronous initialization. |
| 47 virtual bool IsInitializationComplete() const; | 49 virtual bool IsInitializationComplete() const; |
| 48 | 50 |
| 49 // Get the value for a given preference |key| and stores it in |*result|. | 51 // Get the value for a given preference |key| and stores it in |*result|. |
| 50 // |*result| is only modified if the return value is true and if |result| | 52 // |*result| is only modified if the return value is true and if |result| |
| 51 // is not NULL. Ownership of the |*result| value remains with the PrefStore. | 53 // is not NULL. Ownership of the |*result| value remains with the PrefStore. |
| 52 virtual bool GetValue(const std::string& key, | 54 virtual bool GetValue(const std::string& key, |
| 53 const base::Value** result) const = 0; | 55 const base::Value** result) const = 0; |
| 54 | 56 |
| 57 // Get all the values. | |
|
Sam McNally
2017/02/20 00:31:11
Document whether this can return null.
tibell
2017/02/20 03:05:09
Done.
| |
| 58 virtual std::unique_ptr<base::DictionaryValue> GetValues() const = 0; | |
| 59 | |
| 55 protected: | 60 protected: |
| 56 friend class base::RefCounted<PrefStore>; | 61 friend class base::RefCounted<PrefStore>; |
| 57 virtual ~PrefStore() {} | 62 virtual ~PrefStore() {} |
| 58 | 63 |
| 59 private: | 64 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(PrefStore); | 65 DISALLOW_COPY_AND_ASSIGN(PrefStore); |
| 61 }; | 66 }; |
| 62 | 67 |
| 63 #endif // COMPONENTS_PREFS_PREF_STORE_H_ | 68 #endif // COMPONENTS_PREFS_PREF_STORE_H_ |
| OLD | NEW |