| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CRONET_ANDROID_CRONET_IN_MEMORY_PREF_STORE_H_ | 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_IN_MEMORY_PREF_STORE_H_ |
| 6 #define COMPONENTS_CRONET_ANDROID_CRONET_IN_MEMORY_PREF_STORE_H_ | 6 #define COMPONENTS_CRONET_ANDROID_CRONET_IN_MEMORY_PREF_STORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/prefs/persistent_pref_store.h" | 16 #include "components/prefs/persistent_pref_store.h" |
| 17 #include "base/prefs/pref_value_map.h" | 17 #include "components/prefs/pref_value_map.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class Value; | 20 class Value; |
| 21 } | 21 } |
| 22 | 22 |
| 23 // A light-weight prefstore implementation that keeps preferences | 23 // A light-weight prefstore implementation that keeps preferences |
| 24 // in a memory backed store. This is not a persistent prefstore. | 24 // in a memory backed store. This is not a persistent prefstore. |
| 25 // TODO(bengr): Move to base/prefs or some other shared location. | 25 // TODO(bengr): Move to components/prefs or some other shared location. |
| 26 class CronetInMemoryPrefStore : public PersistentPrefStore { | 26 class CronetInMemoryPrefStore : public PersistentPrefStore { |
| 27 public: | 27 public: |
| 28 CronetInMemoryPrefStore(); | 28 CronetInMemoryPrefStore(); |
| 29 | 29 |
| 30 // PrefStore overrides: | 30 // PrefStore overrides: |
| 31 bool GetValue(const std::string& key, | 31 bool GetValue(const std::string& key, |
| 32 const base::Value** result) const override; | 32 const base::Value** result) const override; |
| 33 void AddObserver(PrefStore::Observer* observer) override; | 33 void AddObserver(PrefStore::Observer* observer) override; |
| 34 void RemoveObserver(PrefStore::Observer* observer) override; | 34 void RemoveObserver(PrefStore::Observer* observer) override; |
| 35 bool HasObservers() const override; | 35 bool HasObservers() const override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 | 57 |
| 58 // Stores the preference values. | 58 // Stores the preference values. |
| 59 PrefValueMap prefs_; | 59 PrefValueMap prefs_; |
| 60 | 60 |
| 61 base::ObserverList<PrefStore::Observer, true> observers_; | 61 base::ObserverList<PrefStore::Observer, true> observers_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(CronetInMemoryPrefStore); | 63 DISALLOW_COPY_AND_ASSIGN(CronetInMemoryPrefStore); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 #endif // COMPONENTS_CRONET_ANDROID_CRONET_IN_MEMORY_PREF_STORE_H_ | 66 #endif // COMPONENTS_CRONET_ANDROID_CRONET_IN_MEMORY_PREF_STORE_H_ |
| OLD | NEW |