| 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 SERVICES_PREFERENCES_PUBLIC_CPP_PREFS_OBSERVER_STORE_H_ | 5 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREFS_OBSERVER_STORE_H_ |
| 6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREFS_OBSERVER_STORE_H_ | 6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREFS_OBSERVER_STORE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/prefs/value_map_pref_store.h" | 11 #include "components/prefs/value_map_pref_store.h" |
| 12 #include "mojo/common/common_custom_types.mojom.h" | 12 #include "mojo/common/common_custom_types.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
| 14 #include "services/preferences/public/interfaces/preferences.mojom.h" | 14 #include "services/preferences/public/interfaces/preferences.mojom.h" |
| 15 | 15 |
| 16 namespace shell { | |
| 17 class Connector; | |
| 18 } | |
| 19 | |
| 20 class PrefObserverStoreTest; | 16 class PrefObserverStoreTest; |
| 21 | 17 |
| 22 // An implementation of PrefStore which uses prefs::mojom::PreferenceManager as | 18 // An implementation of PrefStore which uses prefs::mojom::PreferenceManager as |
| 23 // the backing of the preferences. | 19 // the backing of the preferences. |
| 24 // | 20 // |
| 25 // PrefObserverStore caches the values locally to provide synchronous access. | 21 // PrefObserverStore caches the values locally to provide synchronous access. |
| 26 // The cache is empty until the first notification of OnPreferencesChanged is | 22 // The cache is empty until the first notification of OnPreferencesChanged is |
| 27 // received from the prefs::mojom::PreferenceManager. Upon recieving an initial | 23 // received from the prefs::mojom::PreferenceManager. Upon recieving an initial |
| 28 // OnPreferencesChanged initialization will be considered as completed, and any | 24 // OnPreferencesChanged initialization will be considered as completed, and any |
| 29 // PrefStore::Observer will be notified of OnInitializationCompleted. | 25 // PrefStore::Observer will be notified of OnInitializationCompleted. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 69 |
| 74 std::set<std::string> keys_; | 70 std::set<std::string> keys_; |
| 75 | 71 |
| 76 // True upon the first OnPreferencesChanged received after Init. | 72 // True upon the first OnPreferencesChanged received after Init. |
| 77 bool initialized_; | 73 bool initialized_; |
| 78 | 74 |
| 79 DISALLOW_COPY_AND_ASSIGN(PrefObserverStore); | 75 DISALLOW_COPY_AND_ASSIGN(PrefObserverStore); |
| 80 }; | 76 }; |
| 81 | 77 |
| 82 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREFS_OBSERVER_STORE_H_ | 78 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREFS_OBSERVER_STORE_H_ |
| OLD | NEW |