| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 NET_NQE_NETWORK_QUALITIES_PREFS_MANAGER_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITIES_PREFS_MANAGER_H_ |
| 6 #define NET_NQE_NETWORK_QUALITIES_PREFS_MANAGER_H_ | 6 #define NET_NQE_NETWORK_QUALITIES_PREFS_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 : public nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver { | 47 : public nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver { |
| 48 public: | 48 public: |
| 49 // Provides an interface that must be implemented by the embedder. | 49 // Provides an interface that must be implemented by the embedder. |
| 50 class NET_EXPORT PrefDelegate { | 50 class NET_EXPORT PrefDelegate { |
| 51 public: | 51 public: |
| 52 virtual ~PrefDelegate() {} | 52 virtual ~PrefDelegate() {} |
| 53 | 53 |
| 54 // Sets the persistent pref to the given value. | 54 // Sets the persistent pref to the given value. |
| 55 virtual void SetDictionaryValue(const base::DictionaryValue& value) = 0; | 55 virtual void SetDictionaryValue(const base::DictionaryValue& value) = 0; |
| 56 | 56 |
| 57 // Returns the peristent prefs. | 57 // Returns a copy of the persistent prefs. |
| 58 virtual const base::DictionaryValue& GetDictionaryValue() = 0; | 58 virtual std::unique_ptr<base::DictionaryValue> GetDictionaryValue() = 0; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Creates an instance of the NetworkQualitiesPrefsManager. Ownership of | 61 // Creates an instance of the NetworkQualitiesPrefsManager. Ownership of |
| 62 // |pref_delegate| is taken by this class. Must be constructed on the pref | 62 // |pref_delegate| is taken by this class. Must be constructed on the pref |
| 63 // thread, and then moved to network thread. | 63 // thread, and then moved to network thread. |
| 64 explicit NetworkQualitiesPrefsManager( | 64 explicit NetworkQualitiesPrefsManager( |
| 65 std::unique_ptr<PrefDelegate> pref_delegate); | 65 std::unique_ptr<PrefDelegate> pref_delegate); |
| 66 ~NetworkQualitiesPrefsManager() override; | 66 ~NetworkQualitiesPrefsManager() override; |
| 67 | 67 |
| 68 // Initialize on the Network thread. | 68 // Initialize on the Network thread. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 // Used to get |weak_ptr_| to self on the pref thread. | 116 // Used to get |weak_ptr_| to self on the pref thread. |
| 117 base::WeakPtrFactory<NetworkQualitiesPrefsManager> pref_weak_ptr_factory_; | 117 base::WeakPtrFactory<NetworkQualitiesPrefsManager> pref_weak_ptr_factory_; |
| 118 | 118 |
| 119 DISALLOW_COPY_AND_ASSIGN(NetworkQualitiesPrefsManager); | 119 DISALLOW_COPY_AND_ASSIGN(NetworkQualitiesPrefsManager); |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 } // namespace net | 122 } // namespace net |
| 123 | 123 |
| 124 #endif // NET_NQE_NETWORK_QUALITIES_PREFS_MANAGER_H_ | 124 #endif // NET_NQE_NETWORK_QUALITIES_PREFS_MANAGER_H_ |
| OLD | NEW |