| OLD | NEW |
| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 SyncClient* sync_client, | 68 SyncClient* sync_client, |
| 69 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, | 69 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, |
| 70 invalidation::InvalidationService* invalidator, | 70 invalidation::InvalidationService* invalidator, |
| 71 const base::WeakPtr<SyncPrefs>& sync_prefs, | 71 const base::WeakPtr<SyncPrefs>& sync_prefs, |
| 72 const base::FilePath& sync_folder); | 72 const base::FilePath& sync_folder); |
| 73 ~SyncBackendHostImpl() override; | 73 ~SyncBackendHostImpl() override; |
| 74 | 74 |
| 75 // SyncBackendHost implementation. | 75 // SyncBackendHost implementation. |
| 76 void Initialize( | 76 void Initialize( |
| 77 SyncFrontend* frontend, | 77 SyncFrontend* frontend, |
| 78 std::unique_ptr<base::Thread> sync_thread, | 78 base::Thread* sync_thread, |
| 79 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 79 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 80 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, | 80 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, |
| 81 const WeakHandle<JsEventHandler>& event_handler, | 81 const WeakHandle<JsEventHandler>& event_handler, |
| 82 const GURL& service_url, | 82 const GURL& service_url, |
| 83 const std::string& sync_user_agent, | 83 const std::string& sync_user_agent, |
| 84 const SyncCredentials& credentials, | 84 const SyncCredentials& credentials, |
| 85 bool delete_sync_data_folder, | 85 bool delete_sync_data_folder, |
| 86 bool enable_local_sync_backend, | 86 bool enable_local_sync_backend, |
| 87 const base::FilePath& local_sync_backend_folder, | 87 const base::FilePath& local_sync_backend_folder, |
| 88 std::unique_ptr<SyncManagerFactory> sync_manager_factory, | 88 std::unique_ptr<SyncManagerFactory> sync_manager_factory, |
| 89 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, | 89 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, |
| 90 const base::Closure& report_unrecoverable_error_function, | 90 const base::Closure& report_unrecoverable_error_function, |
| 91 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, | 91 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, |
| 92 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state) | 92 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state) |
| 93 override; | 93 override; |
| 94 void TriggerRefresh(const ModelTypeSet& types) override; | 94 void TriggerRefresh(const ModelTypeSet& types) override; |
| 95 void UpdateCredentials(const SyncCredentials& credentials) override; | 95 void UpdateCredentials(const SyncCredentials& credentials) override; |
| 96 void StartSyncingWithServer() override; | 96 void StartSyncingWithServer() override; |
| 97 void SetEncryptionPassphrase(const std::string& passphrase, | 97 void SetEncryptionPassphrase(const std::string& passphrase, |
| 98 bool is_explicit) override; | 98 bool is_explicit) override; |
| 99 bool SetDecryptionPassphrase(const std::string& passphrase) override | 99 bool SetDecryptionPassphrase(const std::string& passphrase) override |
| 100 WARN_UNUSED_RESULT; | 100 WARN_UNUSED_RESULT; |
| 101 void StopSyncingForShutdown() override; | 101 void StopSyncingForShutdown() override; |
| 102 std::unique_ptr<base::Thread> Shutdown(ShutdownReason reason) override; | 102 void Shutdown(ShutdownReason reason) override; |
| 103 void UnregisterInvalidationIds() override; | 103 void UnregisterInvalidationIds() override; |
| 104 ModelTypeSet ConfigureDataTypes( | 104 ModelTypeSet ConfigureDataTypes( |
| 105 ConfigureReason reason, | 105 ConfigureReason reason, |
| 106 const DataTypeConfigStateMap& config_state_map, | 106 const DataTypeConfigStateMap& config_state_map, |
| 107 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | 107 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, |
| 108 const base::Callback<void()>& retry_callback) override; | 108 const base::Callback<void()>& retry_callback) override; |
| 109 void ActivateDirectoryDataType(ModelType type, | 109 void ActivateDirectoryDataType(ModelType type, |
| 110 ModelSafeGroup group, | 110 ModelSafeGroup group, |
| 111 ChangeProcessor* change_processor) override; | 111 ChangeProcessor* change_processor) override; |
| 112 void DeactivateDirectoryDataType(ModelType type) override; | 112 void DeactivateDirectoryDataType(ModelType type) override; |
| 113 void ActivateNonBlockingDataType(ModelType type, | 113 void ActivateNonBlockingDataType(ModelType type, |
| 114 std::unique_ptr<ActivationContext>) override; | 114 std::unique_ptr<ActivationContext>) override; |
| 115 void DeactivateNonBlockingDataType(ModelType type) override; | 115 void DeactivateNonBlockingDataType(ModelType type) override; |
| 116 void EnableEncryptEverything() override; | 116 void EnableEncryptEverything() override; |
| 117 UserShare* GetUserShare() const override; | 117 UserShare* GetUserShare() const override; |
| 118 Status GetDetailedStatus() override; | 118 Status GetDetailedStatus() override; |
| 119 SyncCycleSnapshot GetLastCycleSnapshot() const override; | 119 SyncCycleSnapshot GetLastCycleSnapshot() const override; |
| 120 bool HasUnsyncedItems() const override; | 120 bool HasUnsyncedItems() const override; |
| 121 bool IsNigoriEnabled() const override; | 121 bool IsNigoriEnabled() const override; |
| 122 PassphraseType GetPassphraseType() const override; | 122 PassphraseType GetPassphraseType() const override; |
| 123 base::Time GetExplicitPassphraseTime() const override; | 123 base::Time GetExplicitPassphraseTime() const override; |
| 124 bool IsCryptographerReady(const BaseTransaction* trans) const override; | 124 bool IsCryptographerReady(const BaseTransaction* trans) const override; |
| 125 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const override; | 125 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const override; |
| 126 void FlushDirectory() const override; | 126 void FlushDirectory() const override; |
| 127 void RequestBufferedProtocolEventsAndEnableForwarding() override; | 127 void RequestBufferedProtocolEventsAndEnableForwarding() override; |
| 128 void DisableProtocolEventForwarding() override; | 128 void DisableProtocolEventForwarding() override; |
| 129 void EnableDirectoryTypeDebugInfoForwarding() override; | 129 void EnableDirectoryTypeDebugInfoForwarding() override; |
| 130 void DisableDirectoryTypeDebugInfoForwarding() override; | 130 void DisableDirectoryTypeDebugInfoForwarding() override; |
| 131 base::MessageLoop* GetSyncLoopForTesting() override; | |
| 132 void RefreshTypesForTest(ModelTypeSet types) override; | 131 void RefreshTypesForTest(ModelTypeSet types) override; |
| 133 void ClearServerData( | 132 void ClearServerData( |
| 134 const SyncManager::ClearServerDataCallback& callback) override; | 133 const SyncManager::ClearServerDataCallback& callback) override; |
| 135 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override; | 134 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override; |
| 136 | 135 |
| 137 // InvalidationHandler implementation. | 136 // InvalidationHandler implementation. |
| 138 void OnInvalidatorStateChange(InvalidatorState state) override; | 137 void OnInvalidatorStateChange(InvalidatorState state) override; |
| 139 void OnIncomingInvalidation( | 138 void OnIncomingInvalidation( |
| 140 const ObjectIdInvalidationMap& invalidation_map) override; | 139 const ObjectIdInvalidationMap& invalidation_map) override; |
| 141 std::string GetOwnerName() const override; | 140 std::string GetOwnerName() const override; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 293 |
| 295 void ClearServerDataDoneOnFrontendLoop( | 294 void ClearServerDataDoneOnFrontendLoop( |
| 296 const SyncManager::ClearServerDataCallback& frontend_callback); | 295 const SyncManager::ClearServerDataCallback& frontend_callback); |
| 297 | 296 |
| 298 // A reference to the TaskRUnner used to construct |this|, so we know how to | 297 // A reference to the TaskRUnner used to construct |this|, so we know how to |
| 299 // safely talk back to the SyncFrontend. | 298 // safely talk back to the SyncFrontend. |
| 300 scoped_refptr<base::SingleThreadTaskRunner> const frontend_task_runner_; | 299 scoped_refptr<base::SingleThreadTaskRunner> const frontend_task_runner_; |
| 301 | 300 |
| 302 SyncClient* const sync_client_; | 301 SyncClient* const sync_client_; |
| 303 | 302 |
| 303 // A pointer to the sync thread. |
| 304 base::Thread* sync_thread_; |
| 305 |
| 304 // The UI thread's task runner. | 306 // The UI thread's task runner. |
| 305 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; | 307 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; |
| 306 | 308 |
| 307 // Name used for debugging (set from profile_->GetDebugName()). | 309 // Name used for debugging (set from profile_->GetDebugName()). |
| 308 const std::string name_; | 310 const std::string name_; |
| 309 | 311 |
| 310 // Our core, which communicates directly to the syncapi. Use refptr instead | 312 // Our core, which communicates directly to the syncapi. Use refptr instead |
| 311 // of WeakHandle because |core_| is created on UI loop but released on | 313 // of WeakHandle because |core_| is created on UI loop but released on |
| 312 // sync loop. | 314 // sync loop. |
| 313 scoped_refptr<SyncBackendHostCore> core_; | 315 scoped_refptr<SyncBackendHostCore> core_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 bool invalidation_handler_registered_; | 354 bool invalidation_handler_registered_; |
| 353 | 355 |
| 354 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; | 356 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; |
| 355 | 357 |
| 356 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); | 358 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); |
| 357 }; | 359 }; |
| 358 | 360 |
| 359 } // namespace syncer | 361 } // namespace syncer |
| 360 | 362 |
| 361 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 363 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
| OLD | NEW |