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

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

Issue 2856083002: Pref service: support for incognito prefs (Closed)
Patch Set: Fix compilation on Windows Created 3 years, 7 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_PREF_STORE_MANAGER_IMPL_H_ 5 #ifndef SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_
6 #define SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_ 6 #define SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 scoped_refptr<base::SequencedWorkerPool> worker_pool); 48 scoped_refptr<base::SequencedWorkerPool> worker_pool);
49 ~PrefStoreManagerImpl() override; 49 ~PrefStoreManagerImpl() override;
50 50
51 private: 51 private:
52 struct PendingConnect; 52 struct PendingConnect;
53 53
54 // mojom::PrefStoreRegistry: 54 // mojom::PrefStoreRegistry:
55 void Register(PrefValueStore::PrefStoreType type, 55 void Register(PrefValueStore::PrefStoreType type,
56 mojom::PrefStorePtr pref_store_ptr) override; 56 mojom::PrefStorePtr pref_store_ptr) override;
57 57
58 // mojom::PrefStoreConnector: |already_connected_types| must not include 58 // mojom::PrefStoreConnector:
59 // PrefValueStore::DEFAULT_STORE and PrefValueStore::USER_STORE as these must 59 // |already_connected_types| must not include PrefValueStore::DEFAULT_STORE
60 // always be accessed through the service. 60 // and PrefValueStore::USER_STORE as these must always be accessed through the
61 // service.
61 void Connect( 62 void Connect(
62 mojom::PrefRegistryPtr pref_registry, 63 mojom::PrefRegistryPtr pref_registry,
63 const std::vector<PrefValueStore::PrefStoreType>& already_connected_types, 64 const std::vector<PrefValueStore::PrefStoreType>& already_connected_types,
64 const ConnectCallback& callback) override; 65 const ConnectCallback& callback) override;
66 void ConnectToUserPrefStore(mojom::PrefStoreRequest request) override;
65 67
66 void BindPrefStoreConnectorRequest( 68 void BindPrefStoreConnectorRequest(
67 const service_manager::BindSourceInfo& source_info, 69 const service_manager::BindSourceInfo& source_info,
68 prefs::mojom::PrefStoreConnectorRequest request); 70 prefs::mojom::PrefStoreConnectorRequest request);
69 void BindPrefStoreRegistryRequest( 71 void BindPrefStoreRegistryRequest(
70 const service_manager::BindSourceInfo& source_info, 72 const service_manager::BindSourceInfo& source_info,
71 prefs::mojom::PrefStoreRegistryRequest request); 73 prefs::mojom::PrefStoreRegistryRequest request);
72 void BindPrefServiceControlRequest( 74 void BindPrefServiceControlRequest(
73 const service_manager::BindSourceInfo& source_info, 75 const service_manager::BindSourceInfo& source_info,
74 prefs::mojom::PrefServiceControlRequest request); 76 prefs::mojom::PrefServiceControlRequest request);
75 77
76 // PrefServiceControl: 78 // PrefServiceControl:
77 void Init(mojom::PersistentPrefStoreConfigurationPtr configuration) override; 79 void Init(mojom::PersistentPrefStoreConfigurationPtr configuration) override;
78 80
79 // service_manager::Service: 81 // service_manager::Service:
80 void OnStart() override; 82 void OnStart() override;
81 void OnBindInterface(const service_manager::BindSourceInfo& source_info, 83 void OnBindInterface(const service_manager::BindSourceInfo& source_info,
82 const std::string& interface_name, 84 const std::string& interface_name,
83 mojo::ScopedMessagePipeHandle interface_pipe) override; 85 mojo::ScopedMessagePipeHandle interface_pipe) override;
84 86
85 // Called when a PrefStore previously registered using |Register| disconnects. 87 // Called when a PrefStore previously registered using |Register| disconnects.
86 void OnPrefStoreDisconnect(PrefValueStore::PrefStoreType type); 88 void OnPrefStoreDisconnect(PrefValueStore::PrefStoreType type);
87 89
88 // Have all the expected PrefStores connected? 90 // Have all the expected PrefStores connected?
89 bool AllConnected() const; 91 bool AllConnected() const;
90 92
91 void ProcessPendingConnects(); 93 void ProcessPendingConnects();
92 94
95 std::vector<std::string> RegisterPrefs(mojom::PrefRegistryPtr pref_registry);
96
93 void ConnectImpl( 97 void ConnectImpl(
94 mojom::PrefRegistryPtr pref_registry, 98 mojom::PrefRegistryPtr pref_registry,
95 const std::vector<PrefValueStore::PrefStoreType>& already_connected_types, 99 const std::vector<PrefValueStore::PrefStoreType>& already_connected_types,
96 const ConnectCallback& callback); 100 const ConnectCallback& callback);
97 101
98 void OnPersistentPrefStoreReady(); 102 void OnPersistentPrefStoreReady();
99 103
100 // PrefStores that need to register before replying to any Connect calls. This 104 // PrefStores that need to register before replying to any Connect calls. This
101 // does not include the PersistentPrefStore, which is handled separately. 105 // does not include the PersistentPrefStore, which is handled separately.
102 std::set<PrefValueStore::PrefStoreType> expected_pref_stores_; 106 std::set<PrefValueStore::PrefStoreType> expected_pref_stores_;
103 107
104 // Registered pref stores. 108 // Registered pref stores.
105 std::unordered_map<PrefValueStore::PrefStoreType, mojom::PrefStorePtr> 109 std::unordered_map<PrefValueStore::PrefStoreType, mojom::PrefStorePtr>
106 pref_store_ptrs_; 110 pref_store_ptrs_;
107 111
108 // We hold on to the connection request callbacks until all expected 112 // We hold on to the connection request callbacks until all expected
109 // PrefStores have registered. 113 // PrefStores have registered.
110 std::vector<PendingConnect> pending_connects_; 114 std::vector<PendingConnect> pending_connects_;
111 115
112 mojo::BindingSet<mojom::PrefStoreConnector> connector_bindings_; 116 mojo::BindingSet<mojom::PrefStoreConnector> connector_bindings_;
113 mojo::BindingSet<mojom::PrefStoreRegistry> registry_bindings_; 117 mojo::BindingSet<mojom::PrefStoreRegistry> registry_bindings_;
114 std::unique_ptr<PersistentPrefStoreImpl> persistent_pref_store_; 118 std::unique_ptr<PersistentPrefStoreImpl> persistent_pref_store_;
115 mojo::Binding<mojom::PrefServiceControl> init_binding_; 119 mojo::Binding<mojom::PrefServiceControl> init_binding_;
116 120
121 mojom::PrefStoreConnectorPtr incognito_connector_;
122 // Read-only connections to the persistent pref store.
123 std::unique_ptr<mojo::BindingSet<mojom::PrefStore>>
124 ro_persistent_pref_store_bindings_;
Sam McNally 2017/05/10 01:22:16 Don't abbreviate. Also, why is this here instead o
125 // Requests queued until the persistent pref store is ready.
126 std::vector<mojom::PrefStoreRequest>
127 pending_ro_persistent_pref_store_requests_;
128
117 const scoped_refptr<DefaultPrefStore> defaults_; 129 const scoped_refptr<DefaultPrefStore> defaults_;
118 const std::unique_ptr<PrefStoreImpl> defaults_wrapper_; 130 const std::unique_ptr<PrefStoreImpl> defaults_wrapper_;
119 131
120 const scoped_refptr<base::SequencedWorkerPool> worker_pool_; 132 const scoped_refptr<base::SequencedWorkerPool> worker_pool_;
121 133
122 service_manager::BinderRegistry registry_; 134 service_manager::BinderRegistry registry_;
123 135
124 DISALLOW_COPY_AND_ASSIGN(PrefStoreManagerImpl); 136 DISALLOW_COPY_AND_ASSIGN(PrefStoreManagerImpl);
125 }; 137 };
126 138
127 } // namespace prefs 139 } // namespace prefs
128 140
129 #endif // SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_ 141 #endif // SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698