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

Side by Side Diff: components/sync/driver/glue/sync_backend_host_impl.h

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 18 matching lines...) Expand all
29 #include "components/sync/driver/glue/sync_backend_host.h" 29 #include "components/sync/driver/glue/sync_backend_host.h"
30 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" 30 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
31 #include "components/sync/engine/cycle/type_debug_info_observer.h" 31 #include "components/sync/engine/cycle/type_debug_info_observer.h"
32 #include "components/sync/protocol/encryption.pb.h" 32 #include "components/sync/protocol/encryption.pb.h"
33 #include "components/sync/protocol/sync_protocol_error.h" 33 #include "components/sync/protocol/sync_protocol_error.h"
34 34
35 class GURL; 35 class GURL;
36 36
37 namespace base { 37 namespace base {
38 class MessageLoop; 38 class MessageLoop;
39 } // base 39 }
40 40
41 namespace invalidation { 41 namespace invalidation {
42 class InvalidationService; 42 class InvalidationService;
43 } // namespace invalidation 43 }
44 44
45 namespace syncer { 45 namespace syncer {
46 class SyncManagerFactory;
47 class UnrecoverableErrorHandler;
48 }
49
50 namespace sync_driver {
51 class SyncClient;
52 class SyncPrefs;
53 }
54
55 namespace browser_sync {
46 56
47 class ChangeProcessor; 57 class ChangeProcessor;
48 class SyncBackendHostCore; 58 class SyncBackendHostCore;
49 class SyncBackendRegistrar; 59 class SyncBackendRegistrar;
50 class SyncClient;
51 class SyncManagerFactory;
52 class SyncPrefs;
53 class UnrecoverableErrorHandler;
54 struct DoInitializeOptions; 60 struct DoInitializeOptions;
55 61
56 // The only real implementation of the SyncBackendHost. See that interface's 62 // The only real implementation of the SyncBackendHost. See that interface's
57 // definition for documentation of public methods. 63 // definition for documentation of public methods.
58 class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler { 64 class SyncBackendHostImpl : public SyncBackendHost,
65 public syncer::InvalidationHandler {
59 public: 66 public:
60 typedef SyncStatus Status; 67 typedef syncer::SyncStatus Status;
61 68
62 // Create a SyncBackendHost with a reference to the |frontend| that 69 // Create a SyncBackendHost with a reference to the |frontend| that
63 // it serves and communicates to via the SyncFrontend interface (on 70 // it serves and communicates to via the SyncFrontend interface (on
64 // the same thread it used to call the constructor). Must outlive 71 // the same thread it used to call the constructor). Must outlive
65 // |sync_prefs|. 72 // |sync_prefs|.
66 SyncBackendHostImpl( 73 SyncBackendHostImpl(
67 const std::string& name, 74 const std::string& name,
68 SyncClient* sync_client, 75 sync_driver::SyncClient* sync_client,
69 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, 76 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
70 invalidation::InvalidationService* invalidator, 77 invalidation::InvalidationService* invalidator,
71 const base::WeakPtr<SyncPrefs>& sync_prefs, 78 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
72 const base::FilePath& sync_folder); 79 const base::FilePath& sync_folder);
73 ~SyncBackendHostImpl() override; 80 ~SyncBackendHostImpl() override;
74 81
75 // SyncBackendHost implementation. 82 // SyncBackendHost implementation.
76 void Initialize( 83 void Initialize(
77 SyncFrontend* frontend, 84 sync_driver::SyncFrontend* frontend,
78 std::unique_ptr<base::Thread> sync_thread, 85 std::unique_ptr<base::Thread> sync_thread,
79 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, 86 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
80 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, 87 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread,
81 const WeakHandle<JsEventHandler>& event_handler, 88 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
82 const GURL& service_url, 89 const GURL& service_url,
83 const std::string& sync_user_agent, 90 const std::string& sync_user_agent,
84 const SyncCredentials& credentials, 91 const syncer::SyncCredentials& credentials,
85 bool delete_sync_data_folder, 92 bool delete_sync_data_folder,
86 std::unique_ptr<SyncManagerFactory> sync_manager_factory, 93 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory,
87 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, 94 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>&
95 unrecoverable_error_handler,
88 const base::Closure& report_unrecoverable_error_function, 96 const base::Closure& report_unrecoverable_error_function,
89 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, 97 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter,
90 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state) 98 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
91 override; 99 saved_nigori_state) override;
92 void TriggerRefresh(const ModelTypeSet& types) override; 100 void TriggerRefresh(const syncer::ModelTypeSet& types) override;
93 void UpdateCredentials(const SyncCredentials& credentials) override; 101 void UpdateCredentials(const syncer::SyncCredentials& credentials) override;
94 void StartSyncingWithServer() override; 102 void StartSyncingWithServer() override;
95 void SetEncryptionPassphrase(const std::string& passphrase, 103 void SetEncryptionPassphrase(const std::string& passphrase,
96 bool is_explicit) override; 104 bool is_explicit) override;
97 bool SetDecryptionPassphrase(const std::string& passphrase) override 105 bool SetDecryptionPassphrase(const std::string& passphrase) override
98 WARN_UNUSED_RESULT; 106 WARN_UNUSED_RESULT;
99 void StopSyncingForShutdown() override; 107 void StopSyncingForShutdown() override;
100 std::unique_ptr<base::Thread> Shutdown(ShutdownReason reason) override; 108 std::unique_ptr<base::Thread> Shutdown(
109 syncer::ShutdownReason reason) override;
101 void UnregisterInvalidationIds() override; 110 void UnregisterInvalidationIds() override;
102 ModelTypeSet ConfigureDataTypes( 111 syncer::ModelTypeSet ConfigureDataTypes(
103 ConfigureReason reason, 112 syncer::ConfigureReason reason,
104 const DataTypeConfigStateMap& config_state_map, 113 const DataTypeConfigStateMap& config_state_map,
105 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, 114 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>&
115 ready_task,
106 const base::Callback<void()>& retry_callback) override; 116 const base::Callback<void()>& retry_callback) override;
107 void ActivateDirectoryDataType(ModelType type, 117 void ActivateDirectoryDataType(
108 ModelSafeGroup group, 118 syncer::ModelType type,
109 ChangeProcessor* change_processor) override; 119 syncer::ModelSafeGroup group,
110 void DeactivateDirectoryDataType(ModelType type) override; 120 sync_driver::ChangeProcessor* change_processor) override;
111 void ActivateNonBlockingDataType(ModelType type, 121 void DeactivateDirectoryDataType(syncer::ModelType type) override;
112 std::unique_ptr<ActivationContext>) override; 122 void ActivateNonBlockingDataType(
113 void DeactivateNonBlockingDataType(ModelType type) override; 123 syncer::ModelType type,
124 std::unique_ptr<syncer_v2::ActivationContext>) override;
125 void DeactivateNonBlockingDataType(syncer::ModelType type) override;
114 void EnableEncryptEverything() override; 126 void EnableEncryptEverything() override;
115 UserShare* GetUserShare() const override; 127 syncer::UserShare* GetUserShare() const override;
116 Status GetDetailedStatus() override; 128 Status GetDetailedStatus() override;
117 SyncCycleSnapshot GetLastCycleSnapshot() const override; 129 syncer::SyncCycleSnapshot GetLastCycleSnapshot() const override;
118 bool HasUnsyncedItems() const override; 130 bool HasUnsyncedItems() const override;
119 bool IsNigoriEnabled() const override; 131 bool IsNigoriEnabled() const override;
120 PassphraseType GetPassphraseType() const override; 132 syncer::PassphraseType GetPassphraseType() const override;
121 base::Time GetExplicitPassphraseTime() const override; 133 base::Time GetExplicitPassphraseTime() const override;
122 bool IsCryptographerReady(const BaseTransaction* trans) const override; 134 bool IsCryptographerReady(
123 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const override; 135 const syncer::BaseTransaction* trans) const override;
136 void GetModelSafeRoutingInfo(
137 syncer::ModelSafeRoutingInfo* out) const override;
124 void FlushDirectory() const override; 138 void FlushDirectory() const override;
125 void RequestBufferedProtocolEventsAndEnableForwarding() override; 139 void RequestBufferedProtocolEventsAndEnableForwarding() override;
126 void DisableProtocolEventForwarding() override; 140 void DisableProtocolEventForwarding() override;
127 void EnableDirectoryTypeDebugInfoForwarding() override; 141 void EnableDirectoryTypeDebugInfoForwarding() override;
128 void DisableDirectoryTypeDebugInfoForwarding() override; 142 void DisableDirectoryTypeDebugInfoForwarding() override;
129 base::MessageLoop* GetSyncLoopForTesting() override; 143 base::MessageLoop* GetSyncLoopForTesting() override;
130 void RefreshTypesForTest(ModelTypeSet types) override; 144 void RefreshTypesForTest(syncer::ModelTypeSet types) override;
131 void ClearServerData( 145 void ClearServerData(
132 const SyncManager::ClearServerDataCallback& callback) override; 146 const syncer::SyncManager::ClearServerDataCallback& callback) override;
133 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override; 147 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override;
134 148
135 // InvalidationHandler implementation. 149 // InvalidationHandler implementation.
136 void OnInvalidatorStateChange(InvalidatorState state) override; 150 void OnInvalidatorStateChange(syncer::InvalidatorState state) override;
137 void OnIncomingInvalidation( 151 void OnIncomingInvalidation(
138 const ObjectIdInvalidationMap& invalidation_map) override; 152 const syncer::ObjectIdInvalidationMap& invalidation_map) override;
139 std::string GetOwnerName() const override; 153 std::string GetOwnerName() const override;
140 154
141 protected: 155 protected:
142 // The types and functions below are protected so that test 156 // The types and functions below are protected so that test
143 // subclasses can use them. 157 // subclasses can use them.
144 158
145 // Allows tests to perform alternate core initialization work. 159 // Allows tests to perform alternate core initialization work.
146 virtual void InitCore(std::unique_ptr<DoInitializeOptions> options); 160 virtual void InitCore(std::unique_ptr<DoInitializeOptions> options);
147 161
148 // Request the syncer to reconfigure with the specfied params. 162 // Request the syncer to reconfigure with the specfied params.
149 // Virtual for testing. 163 // Virtual for testing.
150 virtual void RequestConfigureSyncer( 164 virtual void RequestConfigureSyncer(
151 ConfigureReason reason, 165 syncer::ConfigureReason reason,
152 ModelTypeSet to_download, 166 syncer::ModelTypeSet to_download,
153 ModelTypeSet to_purge, 167 syncer::ModelTypeSet to_purge,
154 ModelTypeSet to_journal, 168 syncer::ModelTypeSet to_journal,
155 ModelTypeSet to_unapply, 169 syncer::ModelTypeSet to_unapply,
156 ModelTypeSet to_ignore, 170 syncer::ModelTypeSet to_ignore,
157 const ModelSafeRoutingInfo& routing_info, 171 const syncer::ModelSafeRoutingInfo& routing_info,
158 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, 172 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>&
173 ready_task,
159 const base::Closure& retry_callback); 174 const base::Closure& retry_callback);
160 175
161 // Called when the syncer has finished performing a configuration. 176 // Called when the syncer has finished performing a configuration.
162 void FinishConfigureDataTypesOnFrontendLoop( 177 void FinishConfigureDataTypesOnFrontendLoop(
163 const ModelTypeSet enabled_types, 178 const syncer::ModelTypeSet enabled_types,
164 const ModelTypeSet succeeded_configuration_types, 179 const syncer::ModelTypeSet succeeded_configuration_types,
165 const ModelTypeSet failed_configuration_types, 180 const syncer::ModelTypeSet failed_configuration_types,
166 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task); 181 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>&
182 ready_task);
167 183
168 // Reports backend initialization success. Includes some objects from sync 184 // Reports backend initialization success. Includes some objects from sync
169 // manager initialization to be passed back to the UI thread. 185 // manager initialization to be passed back to the UI thread.
170 // 186 //
171 // |model_type_connector| is our ModelTypeConnector, which is owned because in 187 // |model_type_connector| is our ModelTypeConnector, which is owned because in
172 // production it is a proxy object to the real ModelTypeConnector. 188 // production it is a proxy object to the real ModelTypeConnector.
173 virtual void HandleInitializationSuccessOnFrontendLoop( 189 virtual void HandleInitializationSuccessOnFrontendLoop(
174 const WeakHandle<JsBackend> js_backend, 190 const syncer::WeakHandle<syncer::JsBackend> js_backend,
175 const WeakHandle<DataTypeDebugInfoListener> debug_info_listener, 191 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>
176 std::unique_ptr<ModelTypeConnector> model_type_connector, 192 debug_info_listener,
193 std::unique_ptr<syncer_v2::ModelTypeConnector> model_type_connector,
177 const std::string& cache_guid); 194 const std::string& cache_guid);
178 195
179 // Forwards a ProtocolEvent to the frontend. Will not be called unless a 196 // Forwards a ProtocolEvent to the frontend. Will not be called unless a
180 // call to SetForwardProtocolEvents() explicitly requested that we start 197 // call to SetForwardProtocolEvents() explicitly requested that we start
181 // forwarding these events. 198 // forwarding these events.
182 void HandleProtocolEventOnFrontendLoop(std::unique_ptr<ProtocolEvent> event); 199 void HandleProtocolEventOnFrontendLoop(
200 std::unique_ptr<syncer::ProtocolEvent> event);
183 201
184 // Forwards a directory commit counter update to the frontend loop. Will not 202 // Forwards a directory commit counter update to the frontend loop. Will not
185 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding() 203 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding()
186 // explicitly requested that we start forwarding these events. 204 // explicitly requested that we start forwarding these events.
187 void HandleDirectoryCommitCountersUpdatedOnFrontendLoop( 205 void HandleDirectoryCommitCountersUpdatedOnFrontendLoop(
188 ModelType type, 206 syncer::ModelType type,
189 const CommitCounters& counters); 207 const syncer::CommitCounters& counters);
190 208
191 // Forwards a directory update counter update to the frontend loop. Will not 209 // Forwards a directory update counter update to the frontend loop. Will not
192 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding() 210 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding()
193 // explicitly requested that we start forwarding these events. 211 // explicitly requested that we start forwarding these events.
194 void HandleDirectoryUpdateCountersUpdatedOnFrontendLoop( 212 void HandleDirectoryUpdateCountersUpdatedOnFrontendLoop(
195 ModelType type, 213 syncer::ModelType type,
196 const UpdateCounters& counters); 214 const syncer::UpdateCounters& counters);
197 215
198 // Forwards a directory status counter update to the frontend loop. Will not 216 // Forwards a directory status counter update to the frontend loop. Will not
199 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding() 217 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding()
200 // explicitly requested that we start forwarding these events. 218 // explicitly requested that we start forwarding these events.
201 void HandleDirectoryStatusCountersUpdatedOnFrontendLoop( 219 void HandleDirectoryStatusCountersUpdatedOnFrontendLoop(
202 ModelType type, 220 syncer::ModelType type,
203 const StatusCounters& counters); 221 const syncer::StatusCounters& counters);
204 222
205 // Overwrites the kSyncInvalidationVersions preference with the most recent 223 // Overwrites the kSyncInvalidationVersions preference with the most recent
206 // set of invalidation versions for each type. 224 // set of invalidation versions for each type.
207 void UpdateInvalidationVersions( 225 void UpdateInvalidationVersions(
208 const std::map<ModelType, int64_t>& invalidation_versions); 226 const std::map<syncer::ModelType, int64_t>& invalidation_versions);
209 227
210 SyncFrontend* frontend() { return frontend_; } 228 sync_driver::SyncFrontend* frontend() { return frontend_; }
211 229
212 private: 230 private:
213 friend class SyncBackendHostCore; 231 friend class SyncBackendHostCore;
214 232
215 // Checks if we have received a notice to turn on experimental datatypes 233 // Checks if we have received a notice to turn on experimental datatypes
216 // (via the nigori node) and informs the frontend if that is the case. 234 // (via the nigori node) and informs the frontend if that is the case.
217 // Note: it is illegal to call this before the backend is initialized. 235 // Note: it is illegal to call this before the backend is initialized.
218 void AddExperimentalTypes(); 236 void AddExperimentalTypes();
219 237
220 // Handles backend initialization failure. 238 // Handles backend initialization failure.
221 void HandleInitializationFailureOnFrontendLoop(); 239 void HandleInitializationFailureOnFrontendLoop();
222 240
223 // Called from Core::OnSyncCycleCompleted to handle updating frontend 241 // Called from Core::OnSyncCycleCompleted to handle updating frontend
224 // thread components. 242 // thread components.
225 void HandleSyncCycleCompletedOnFrontendLoop( 243 void HandleSyncCycleCompletedOnFrontendLoop(
226 const SyncCycleSnapshot& snapshot); 244 const syncer::SyncCycleSnapshot& snapshot);
227 245
228 // Called when the syncer failed to perform a configuration and will 246 // Called when the syncer failed to perform a configuration and will
229 // eventually retry. FinishingConfigurationOnFrontendLoop(..) will be called 247 // eventually retry. FinishingConfigurationOnFrontendLoop(..) will be called
230 // on successful completion. 248 // on successful completion.
231 void RetryConfigurationOnFrontendLoop(const base::Closure& retry_callback); 249 void RetryConfigurationOnFrontendLoop(const base::Closure& retry_callback);
232 250
233 // Helpers to persist a token that can be used to bootstrap sync encryption 251 // Helpers to persist a token that can be used to bootstrap sync encryption
234 // across browser restart to avoid requiring the user to re-enter their 252 // across browser restart to avoid requiring the user to re-enter their
235 // passphrase. |token| must be valid UTF-8 as we use the PrefService for 253 // passphrase. |token| must be valid UTF-8 as we use the PrefService for
236 // storage. 254 // storage.
237 void PersistEncryptionBootstrapToken(const std::string& token, 255 void PersistEncryptionBootstrapToken(const std::string& token,
238 BootstrapTokenType token_type); 256 syncer::BootstrapTokenType token_type);
239 257
240 // For convenience, checks if initialization state is INITIALIZED. 258 // For convenience, checks if initialization state is INITIALIZED.
241 bool initialized() const { return initialized_; } 259 bool initialized() const { return initialized_; }
242 260
243 // Let the front end handle the actionable error event. 261 // Let the front end handle the actionable error event.
244 void HandleActionableErrorEventOnFrontendLoop( 262 void HandleActionableErrorEventOnFrontendLoop(
245 const SyncProtocolError& sync_error); 263 const syncer::SyncProtocolError& sync_error);
246 264
247 // Handle a migration request. 265 // Handle a migration request.
248 void HandleMigrationRequestedOnFrontendLoop(const ModelTypeSet types); 266 void HandleMigrationRequestedOnFrontendLoop(const syncer::ModelTypeSet types);
249 267
250 // Checks if |passphrase| can be used to decrypt the cryptographer's pending 268 // Checks if |passphrase| can be used to decrypt the cryptographer's pending
251 // keys that were cached during NotifyPassphraseRequired. Returns true if 269 // keys that were cached during NotifyPassphraseRequired. Returns true if
252 // decryption was successful. Returns false otherwise. Must be called with a 270 // decryption was successful. Returns false otherwise. Must be called with a
253 // non-empty pending keys cache. 271 // non-empty pending keys cache.
254 bool CheckPassphraseAgainstCachedPendingKeys( 272 bool CheckPassphraseAgainstCachedPendingKeys(
255 const std::string& passphrase) const; 273 const std::string& passphrase) const;
256 274
257 // Invoked when a passphrase is required to decrypt a set of Nigori keys, 275 // Invoked when a passphrase is required to decrypt a set of Nigori keys,
258 // or for encrypting. |reason| denotes why the passphrase was required. 276 // or for encrypting. |reason| denotes why the passphrase was required.
259 // |pending_keys| is a copy of the cryptographer's pending keys, that are 277 // |pending_keys| is a copy of the cryptographer's pending keys, that are
260 // cached by the frontend. If there are no pending keys, or if the passphrase 278 // cached by the frontend. If there are no pending keys, or if the passphrase
261 // required reason is REASON_ENCRYPTION, an empty EncryptedData object is 279 // required reason is REASON_ENCRYPTION, an empty EncryptedData object is
262 // passed. 280 // passed.
263 void NotifyPassphraseRequired(PassphraseRequiredReason reason, 281 void NotifyPassphraseRequired(syncer::PassphraseRequiredReason reason,
264 sync_pb::EncryptedData pending_keys); 282 sync_pb::EncryptedData pending_keys);
265 283
266 // Invoked when the passphrase provided by the user has been accepted. 284 // Invoked when the passphrase provided by the user has been accepted.
267 void NotifyPassphraseAccepted(); 285 void NotifyPassphraseAccepted();
268 286
269 // Invoked when the set of encrypted types or the encrypt 287 // Invoked when the set of encrypted types or the encrypt
270 // everything flag changes. 288 // everything flag changes.
271 void NotifyEncryptedTypesChanged(ModelTypeSet encrypted_types, 289 void NotifyEncryptedTypesChanged(syncer::ModelTypeSet encrypted_types,
272 bool encrypt_everything); 290 bool encrypt_everything);
273 291
274 // Invoked when sync finishes encrypting new datatypes. 292 // Invoked when sync finishes encrypting new datatypes.
275 void NotifyEncryptionComplete(); 293 void NotifyEncryptionComplete();
276 294
277 // Invoked when the passphrase state has changed. Caches the passphrase state 295 // Invoked when the passphrase state has changed. Caches the passphrase state
278 // for later use on the UI thread. 296 // for later use on the UI thread.
279 // If |type| is FROZEN_IMPLICIT_PASSPHRASE or CUSTOM_PASSPHRASE, 297 // If |type| is FROZEN_IMPLICIT_PASSPHRASE or CUSTOM_PASSPHRASE,
280 // |explicit_passphrase_time| is the time at which that passphrase was set 298 // |explicit_passphrase_time| is the time at which that passphrase was set
281 // (if available). 299 // (if available).
282 void HandlePassphraseTypeChangedOnFrontendLoop( 300 void HandlePassphraseTypeChangedOnFrontendLoop(
283 PassphraseType type, 301 syncer::PassphraseType type,
284 base::Time explicit_passphrase_time); 302 base::Time explicit_passphrase_time);
285 303
286 void HandleLocalSetPassphraseEncryptionOnFrontendLoop( 304 void HandleLocalSetPassphraseEncryptionOnFrontendLoop(
287 const SyncEncryptionHandler::NigoriState& nigori_state); 305 const syncer::SyncEncryptionHandler::NigoriState& nigori_state);
288 306
289 // Dispatched to from OnConnectionStatusChange to handle updating 307 // Dispatched to from OnConnectionStatusChange to handle updating
290 // frontend UI components. 308 // frontend UI components.
291 void HandleConnectionStatusChangeOnFrontendLoop(ConnectionStatus status); 309 void HandleConnectionStatusChangeOnFrontendLoop(
310 syncer::ConnectionStatus status);
292 311
293 void ClearServerDataDoneOnFrontendLoop( 312 void ClearServerDataDoneOnFrontendLoop(
294 const SyncManager::ClearServerDataCallback& frontend_callback); 313 const syncer::SyncManager::ClearServerDataCallback& frontend_callback);
295 314
296 // A reference to the TaskRUnner used to construct |this|, so we know how to 315 // A reference to the TaskRUnner used to construct |this|, so we know how to
297 // safely talk back to the SyncFrontend. 316 // safely talk back to the SyncFrontend.
298 scoped_refptr<base::SingleThreadTaskRunner> const frontend_task_runner_; 317 scoped_refptr<base::SingleThreadTaskRunner> const frontend_task_runner_;
299 318
300 SyncClient* const sync_client_; 319 sync_driver::SyncClient* const sync_client_;
301 320
302 // The UI thread's task runner. 321 // The UI thread's task runner.
303 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; 322 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
304 323
305 // Name used for debugging (set from profile_->GetDebugName()). 324 // Name used for debugging (set from profile_->GetDebugName()).
306 const std::string name_; 325 const std::string name_;
307 326
308 // Our core, which communicates directly to the syncapi. Use refptr instead 327 // Our core, which communicates directly to the syncapi. Use refptr instead
309 // of WeakHandle because |core_| is created on UI loop but released on 328 // of WeakHandle because |core_| is created on UI loop but released on
310 // sync loop. 329 // sync loop.
311 scoped_refptr<SyncBackendHostCore> core_; 330 scoped_refptr<SyncBackendHostCore> core_;
312 331
313 // A handle referencing the main interface for non-blocking sync types. This 332 // A handle referencing the main interface for non-blocking sync types. This
314 // object is owned because in production code it is a proxy object. 333 // object is owned because in production code it is a proxy object.
315 std::unique_ptr<ModelTypeConnector> model_type_connector_; 334 std::unique_ptr<syncer_v2::ModelTypeConnector> model_type_connector_;
316 335
317 bool initialized_; 336 bool initialized_;
318 337
319 const base::WeakPtr<SyncPrefs> sync_prefs_; 338 const base::WeakPtr<sync_driver::SyncPrefs> sync_prefs_;
320 339
321 std::unique_ptr<SyncBackendRegistrar> registrar_; 340 std::unique_ptr<SyncBackendRegistrar> registrar_;
322 341
323 // The frontend which we serve (and are owned by). 342 // The frontend which we serve (and are owned by).
324 SyncFrontend* frontend_; 343 sync_driver::SyncFrontend* frontend_;
325 344
326 // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired 345 // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired
327 // is called. This way, before the UI calls SetDecryptionPassphrase on the 346 // is called. This way, before the UI calls SetDecryptionPassphrase on the
328 // syncer, it can avoid the overhead of an asynchronous decryption call and 347 // syncer, it can avoid the overhead of an asynchronous decryption call and
329 // give the user immediate feedback about the passphrase entered by first 348 // give the user immediate feedback about the passphrase entered by first
330 // trying to decrypt the cached pending keys on the UI thread. Note that 349 // trying to decrypt the cached pending keys on the UI thread. Note that
331 // SetDecryptionPassphrase can still fail after the cached pending keys are 350 // SetDecryptionPassphrase can still fail after the cached pending keys are
332 // successfully decrypted if the pending keys have changed since the time they 351 // successfully decrypted if the pending keys have changed since the time they
333 // were cached. 352 // were cached.
334 sync_pb::EncryptedData cached_pending_keys_; 353 sync_pb::EncryptedData cached_pending_keys_;
335 354
336 // The state of the passphrase required to decrypt the bag of encryption keys 355 // The state of the passphrase required to decrypt the bag of encryption keys
337 // in the nigori node. Updated whenever a new nigori node arrives or the user 356 // in the nigori node. Updated whenever a new nigori node arrives or the user
338 // manually changes their passphrase state. Cached so we can synchronously 357 // manually changes their passphrase state. Cached so we can synchronously
339 // check it from the UI thread. 358 // check it from the UI thread.
340 PassphraseType cached_passphrase_type_; 359 syncer::PassphraseType cached_passphrase_type_;
341 360
342 // If an explicit passphrase is in use, the time at which the passphrase was 361 // If an explicit passphrase is in use, the time at which the passphrase was
343 // first set (if available). 362 // first set (if available).
344 base::Time cached_explicit_passphrase_time_; 363 base::Time cached_explicit_passphrase_time_;
345 364
346 // UI-thread cache of the last SyncCycleSnapshot received from syncapi. 365 // UI-thread cache of the last SyncCycleSnapshot received from syncapi.
347 SyncCycleSnapshot last_snapshot_; 366 syncer::SyncCycleSnapshot last_snapshot_;
348 367
349 invalidation::InvalidationService* invalidator_; 368 invalidation::InvalidationService* invalidator_;
350 bool invalidation_handler_registered_; 369 bool invalidation_handler_registered_;
351 370
352 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; 371 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_;
353 372
354 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); 373 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl);
355 }; 374 };
356 375
357 } // namespace syncer 376 } // namespace browser_sync
358 377
359 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ 378 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_core.cc ('k') | components/sync/driver/glue/sync_backend_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698