Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: services/preferences/persistent_pref_store_impl.h

Issue 2777483002: Pref service: Add initial support for pref registration. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_PERSISTENT_PREF_STORE_IMPL_H_ 5 #ifndef SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_
6 #define SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_ 6 #define SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "services/preferences/public/interfaces/preferences.mojom.h" 14 #include "services/preferences/public/interfaces/preferences.mojom.h"
15 #include "services/preferences/public/interfaces/tracked_preference_validation_d elegate.mojom.h" 15 #include "services/preferences/public/interfaces/tracked_preference_validation_d elegate.mojom.h"
16 16
17 namespace base { 17 namespace base {
18 class Value; 18 class Value;
19 } 19 }
20 20
21 namespace prefs { 21 namespace prefs {
22 22
23 class PersistentPrefStoreImpl : public PrefStore::Observer { 23 class PersistentPrefStoreImpl : public PrefStore::Observer {
24 public: 24 public:
25 using ObservedPrefs = std::set<std::string>;
26
25 // If |initialized()| is false after construction, |on_initialized| will be 27 // If |initialized()| is false after construction, |on_initialized| will be
26 // called when it becomes true. 28 // called when it becomes true.
27 PersistentPrefStoreImpl( 29 PersistentPrefStoreImpl(
28 scoped_refptr<PersistentPrefStore> backing_pref_store, 30 scoped_refptr<PersistentPrefStore> backing_pref_store,
29 mojom::TrackedPreferenceValidationDelegatePtr validation_delegate, 31 mojom::TrackedPreferenceValidationDelegatePtr validation_delegate,
30 base::OnceClosure on_initialized); 32 base::OnceClosure on_initialized);
31 33
32 ~PersistentPrefStoreImpl() override; 34 ~PersistentPrefStoreImpl() override;
33 35
34 mojom::PersistentPrefStoreConnectionPtr CreateConnection(); 36 mojom::PersistentPrefStoreConnectionPtr CreateConnection(
37 ObservedPrefs observed_prefs);
35 38
36 bool initialized() { return !initializing_; } 39 bool initialized() { return !initializing_; }
37 40
38 private: 41 private:
39 class Connection; 42 class Connection;
40 43
41 void SetValue(const std::string& key, 44 void SetValue(const std::string& key,
42 std::unique_ptr<base::Value> value, 45 std::unique_ptr<base::Value> value,
43 uint32_t flags); 46 uint32_t flags);
44 47
(...skipping 15 matching lines...) Expand all
60 std::unordered_map<Connection*, std::unique_ptr<Connection>> connections_; 63 std::unordered_map<Connection*, std::unique_ptr<Connection>> connections_;
61 64
62 base::OnceClosure on_initialized_; 65 base::OnceClosure on_initialized_;
63 66
64 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreImpl); 67 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreImpl);
65 }; 68 };
66 69
67 } // namespace prefs 70 } // namespace prefs
68 71
69 #endif // SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_ 72 #endif // SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698