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

Side by Side Diff: services/preferences/public/cpp/persistent_pref_store_client.h

Issue 2791903003: Pref service: have Mash and Chrome connect to the right pref stores (Closed)
Patch Set: ProfilePrefStoreManagerTest: explicit list stores to connect to Created 3 years, 8 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_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ 5 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_
6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ 6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "components/prefs/persistent_pref_store.h" 13 #include "components/prefs/persistent_pref_store.h"
14 #include "components/prefs/pref_value_store.h"
13 #include "services/preferences/public/cpp/pref_store_client_mixin.h" 15 #include "services/preferences/public/cpp/pref_store_client_mixin.h"
14 #include "services/preferences/public/interfaces/preferences.mojom.h" 16 #include "services/preferences/public/interfaces/preferences.mojom.h"
15 17
16 namespace base { 18 namespace base {
17 class Value; 19 class Value;
18 } 20 }
19 21
20 class PrefRegistry; 22 class PrefRegistry;
21 23
22 namespace prefs { 24 namespace prefs {
23 25
24 // An implementation of PersistentPrefStore backed by a 26 // An implementation of PersistentPrefStore backed by a
25 // mojom::PersistentPrefStore and a mojom::PrefStoreObserver. 27 // mojom::PersistentPrefStore and a mojom::PrefStoreObserver.
26 class PersistentPrefStoreClient 28 class PersistentPrefStoreClient
27 : public PrefStoreClientMixin<PersistentPrefStore> { 29 : public PrefStoreClientMixin<PersistentPrefStore> {
28 public: 30 public:
29 PersistentPrefStoreClient(mojom::PrefStoreConnectorPtr connector, 31 PersistentPrefStoreClient(
30 scoped_refptr<PrefRegistry> pref_registry); 32 mojom::PrefStoreConnectorPtr connector,
33 scoped_refptr<PrefRegistry> pref_registry,
34 std::vector<PrefValueStore::PrefStoreType> already_connected_types);
31 35
32 explicit PersistentPrefStoreClient( 36 explicit PersistentPrefStoreClient(
33 mojom::PersistentPrefStoreConnectionPtr connection); 37 mojom::PersistentPrefStoreConnectionPtr connection);
34 38
35 // WriteablePrefStore: 39 // WriteablePrefStore:
36 void SetValue(const std::string& key, 40 void SetValue(const std::string& key,
37 std::unique_ptr<base::Value> value, 41 std::unique_ptr<base::Value> value,
38 uint32_t flags) override; 42 uint32_t flags) override;
39 void RemoveValue(const std::string& key, uint32_t flags) override; 43 void RemoveValue(const std::string& key, uint32_t flags) override;
40 bool GetMutableValue(const std::string& key, base::Value** result) override; 44 bool GetMutableValue(const std::string& key, base::Value** result) override;
(...skipping 21 matching lines...) Expand all
62 prefs::mojom::PrefStoreConnectionPtr> 66 prefs::mojom::PrefStoreConnectionPtr>
63 other_pref_stores); 67 other_pref_stores);
64 68
65 mojom::PrefStoreConnectorPtr connector_; 69 mojom::PrefStoreConnectorPtr connector_;
66 scoped_refptr<PrefRegistry> pref_registry_; 70 scoped_refptr<PrefRegistry> pref_registry_;
67 bool read_only_ = false; 71 bool read_only_ = false;
68 PrefReadError read_error_ = PersistentPrefStore::PREF_READ_ERROR_NONE; 72 PrefReadError read_error_ = PersistentPrefStore::PREF_READ_ERROR_NONE;
69 mojom::PersistentPrefStorePtr pref_store_; 73 mojom::PersistentPrefStorePtr pref_store_;
70 74
71 std::unique_ptr<ReadErrorDelegate> error_delegate_; 75 std::unique_ptr<ReadErrorDelegate> error_delegate_;
76 std::vector<PrefValueStore::PrefStoreType> already_connected_types_;
72 77
73 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreClient); 78 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreClient);
74 }; 79 };
75 80
76 } // namespace prefs 81 } // namespace prefs
77 82
78 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ 83 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_
OLDNEW
« no previous file with comments | « services/preferences/pref_store_manager_impl.cc ('k') | services/preferences/public/cpp/persistent_pref_store_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698