OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_CLIENT_MIXIN_H_ | 5 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_CLIENT_MIXIN_H_ |
6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_CLIENT_MIXIN_H_ | 6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_CLIENT_MIXIN_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // protected member functions. | 47 // protected member functions. |
48 void Init(std::unique_ptr<base::DictionaryValue> initial_prefs, | 48 void Init(std::unique_ptr<base::DictionaryValue> initial_prefs, |
49 bool initialized, | 49 bool initialized, |
50 mojom::PrefStoreObserverRequest observer_request); | 50 mojom::PrefStoreObserverRequest observer_request); |
51 | 51 |
52 base::DictionaryValue& GetMutableValues(); | 52 base::DictionaryValue& GetMutableValues(); |
53 void ReportPrefValueChanged(const std::string& key); | 53 void ReportPrefValueChanged(const std::string& key); |
54 | 54 |
55 private: | 55 private: |
56 // prefs::mojom::PreferenceObserver: | 56 // prefs::mojom::PreferenceObserver: |
| 57 void OnPrefsChanged(std::vector<mojom::PrefUpdatePtr> updates) override; |
| 58 void OnInitializationCompleted(bool succeeded) override; |
| 59 |
57 void OnPrefChanged(const std::string& key, | 60 void OnPrefChanged(const std::string& key, |
58 std::unique_ptr<base::Value> value) override; | 61 std::unique_ptr<base::Value> value); |
59 void OnInitializationCompleted(bool succeeded) override; | |
60 | 62 |
61 // Cached preferences. | 63 // Cached preferences. |
62 // If null, indicates that initialization failed. | 64 // If null, indicates that initialization failed. |
63 std::unique_ptr<base::DictionaryValue> cached_prefs_; | 65 std::unique_ptr<base::DictionaryValue> cached_prefs_; |
64 | 66 |
65 base::ObserverList<PrefStore::Observer, true> observers_; | 67 base::ObserverList<PrefStore::Observer, true> observers_; |
66 | 68 |
67 // Has the PrefStore we're observing been initialized? | 69 // Has the PrefStore we're observing been initialized? |
68 bool initialized_ = false; | 70 bool initialized_ = false; |
69 | 71 |
70 mojo::Binding<mojom::PrefStoreObserver> observer_binding_; | 72 mojo::Binding<mojom::PrefStoreObserver> observer_binding_; |
71 | 73 |
72 DISALLOW_COPY_AND_ASSIGN(PrefStoreClientMixin); | 74 DISALLOW_COPY_AND_ASSIGN(PrefStoreClientMixin); |
73 }; | 75 }; |
74 | 76 |
75 extern template class PrefStoreClientMixin<::PrefStore>; | 77 extern template class PrefStoreClientMixin<::PrefStore>; |
76 extern template class PrefStoreClientMixin<::PersistentPrefStore>; | 78 extern template class PrefStoreClientMixin<::PersistentPrefStore>; |
77 | 79 |
78 } // namespace prefs | 80 } // namespace prefs |
79 | 81 |
80 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_CLIENT_MIXIN_H_ | 82 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_CLIENT_MIXIN_H_ |
OLD | NEW |