| 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 CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // Create a SyncBackendHost with a reference to the |frontend| that | 70 // Create a SyncBackendHost with a reference to the |frontend| that |
| 71 // it serves and communicates to via the SyncFrontend interface (on | 71 // it serves and communicates to via the SyncFrontend interface (on |
| 72 // the same thread it used to call the constructor). Must outlive | 72 // the same thread it used to call the constructor). Must outlive |
| 73 // |sync_prefs|. | 73 // |sync_prefs|. |
| 74 SyncBackendHostImpl(const std::string& name, | 74 SyncBackendHostImpl(const std::string& name, |
| 75 Profile* profile, | 75 Profile* profile, |
| 76 invalidation::InvalidationService* invalidator, | 76 invalidation::InvalidationService* invalidator, |
| 77 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 77 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |
| 78 const base::FilePath& sync_folder); | 78 const base::FilePath& sync_folder); |
| 79 virtual ~SyncBackendHostImpl(); | 79 ~SyncBackendHostImpl() override; |
| 80 | 80 |
| 81 // SyncBackendHost implementation. | 81 // SyncBackendHost implementation. |
| 82 virtual void Initialize( | 82 void Initialize( |
| 83 sync_driver::SyncFrontend* frontend, | 83 sync_driver::SyncFrontend* frontend, |
| 84 scoped_ptr<base::Thread> sync_thread, | 84 scoped_ptr<base::Thread> sync_thread, |
| 85 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 85 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
| 86 const GURL& service_url, | 86 const GURL& service_url, |
| 87 const syncer::SyncCredentials& credentials, | 87 const syncer::SyncCredentials& credentials, |
| 88 bool delete_sync_data_folder, | 88 bool delete_sync_data_folder, |
| 89 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 89 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 90 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, | 90 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, |
| 91 syncer::ReportUnrecoverableErrorFunction | 91 syncer::ReportUnrecoverableErrorFunction |
| 92 report_unrecoverable_error_function, | 92 report_unrecoverable_error_function, |
| 93 syncer::NetworkResources* network_resources) override; | 93 syncer::NetworkResources* network_resources) override; |
| 94 virtual void UpdateCredentials( | 94 void UpdateCredentials(const syncer::SyncCredentials& credentials) override; |
| 95 const syncer::SyncCredentials& credentials) override; | 95 void StartSyncingWithServer() override; |
| 96 virtual void StartSyncingWithServer() override; | 96 void SetEncryptionPassphrase(const std::string& passphrase, |
| 97 virtual void SetEncryptionPassphrase( | 97 bool is_explicit) override; |
| 98 const std::string& passphrase, | 98 bool SetDecryptionPassphrase(const std::string& passphrase) override |
| 99 bool is_explicit) override; | 99 WARN_UNUSED_RESULT; |
| 100 virtual bool SetDecryptionPassphrase(const std::string& passphrase) | 100 void StopSyncingForShutdown() override; |
| 101 override WARN_UNUSED_RESULT; | 101 scoped_ptr<base::Thread> Shutdown(syncer::ShutdownReason reason) override; |
| 102 virtual void StopSyncingForShutdown() override; | 102 void UnregisterInvalidationIds() override; |
| 103 virtual scoped_ptr<base::Thread> Shutdown(syncer::ShutdownReason reason) | 103 void ConfigureDataTypes( |
| 104 override; | |
| 105 virtual void UnregisterInvalidationIds() override; | |
| 106 virtual void ConfigureDataTypes( | |
| 107 syncer::ConfigureReason reason, | 104 syncer::ConfigureReason reason, |
| 108 const DataTypeConfigStateMap& config_state_map, | 105 const DataTypeConfigStateMap& config_state_map, |
| 109 const base::Callback<void(syncer::ModelTypeSet, | 106 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& |
| 110 syncer::ModelTypeSet)>& ready_task, | 107 ready_task, |
| 111 const base::Callback<void()>& retry_callback) override; | 108 const base::Callback<void()>& retry_callback) override; |
| 112 virtual void ActivateDataType( | 109 void ActivateDataType( |
| 113 syncer::ModelType type, syncer::ModelSafeGroup group, | 110 syncer::ModelType type, |
| 114 sync_driver::ChangeProcessor* change_processor) override; | 111 syncer::ModelSafeGroup group, |
| 115 virtual void DeactivateDataType(syncer::ModelType type) override; | 112 sync_driver::ChangeProcessor* change_processor) override; |
| 116 virtual void EnableEncryptEverything() override; | 113 void DeactivateDataType(syncer::ModelType type) override; |
| 117 virtual syncer::UserShare* GetUserShare() const override; | 114 void EnableEncryptEverything() override; |
| 118 virtual scoped_ptr<syncer::SyncContextProxy> GetSyncContextProxy() override; | 115 syncer::UserShare* GetUserShare() const override; |
| 119 virtual Status GetDetailedStatus() override; | 116 scoped_ptr<syncer::SyncContextProxy> GetSyncContextProxy() override; |
| 120 virtual syncer::sessions::SyncSessionSnapshot | 117 Status GetDetailedStatus() override; |
| 121 GetLastSessionSnapshot() const override; | 118 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const override; |
| 122 virtual bool HasUnsyncedItems() const override; | 119 bool HasUnsyncedItems() const override; |
| 123 virtual bool IsNigoriEnabled() const override; | 120 bool IsNigoriEnabled() const override; |
| 124 virtual syncer::PassphraseType GetPassphraseType() const override; | 121 syncer::PassphraseType GetPassphraseType() const override; |
| 125 virtual base::Time GetExplicitPassphraseTime() const override; | 122 base::Time GetExplicitPassphraseTime() const override; |
| 126 virtual bool IsCryptographerReady( | 123 bool IsCryptographerReady( |
| 127 const syncer::BaseTransaction* trans) const override; | 124 const syncer::BaseTransaction* trans) const override; |
| 128 virtual void GetModelSafeRoutingInfo( | 125 void GetModelSafeRoutingInfo( |
| 129 syncer::ModelSafeRoutingInfo* out) const override; | 126 syncer::ModelSafeRoutingInfo* out) const override; |
| 130 virtual void FlushDirectory() const override; | 127 void FlushDirectory() const override; |
| 131 virtual void RequestBufferedProtocolEventsAndEnableForwarding() override; | 128 void RequestBufferedProtocolEventsAndEnableForwarding() override; |
| 132 virtual void DisableProtocolEventForwarding() override; | 129 void DisableProtocolEventForwarding() override; |
| 133 virtual void EnableDirectoryTypeDebugInfoForwarding() override; | 130 void EnableDirectoryTypeDebugInfoForwarding() override; |
| 134 virtual void DisableDirectoryTypeDebugInfoForwarding() override; | 131 void DisableDirectoryTypeDebugInfoForwarding() override; |
| 135 virtual void GetAllNodesForTypes( | 132 void GetAllNodesForTypes( |
| 136 syncer::ModelTypeSet types, | 133 syncer::ModelTypeSet types, |
| 137 base::Callback<void(const std::vector<syncer::ModelType>&, | 134 base::Callback<void(const std::vector<syncer::ModelType>&, |
| 138 ScopedVector<base::ListValue>)> type) override; | 135 ScopedVector<base::ListValue>)> type) override; |
| 139 virtual base::MessageLoop* GetSyncLoopForTesting() override; | 136 base::MessageLoop* GetSyncLoopForTesting() override; |
| 140 | 137 |
| 141 protected: | 138 protected: |
| 142 // The types and functions below are protected so that test | 139 // The types and functions below are protected so that test |
| 143 // subclasses can use them. | 140 // subclasses can use them. |
| 144 | 141 |
| 145 // Allows tests to perform alternate core initialization work. | 142 // Allows tests to perform alternate core initialization work. |
| 146 virtual void InitCore(scoped_ptr<DoInitializeOptions> options); | 143 virtual void InitCore(scoped_ptr<DoInitializeOptions> options); |
| 147 | 144 |
| 148 // Request the syncer to reconfigure with the specfied params. | 145 // Request the syncer to reconfigure with the specfied params. |
| 149 // Virtual for testing. | 146 // Virtual for testing. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 base::Time explicit_passphrase_time); | 282 base::Time explicit_passphrase_time); |
| 286 | 283 |
| 287 void HandleStopSyncingPermanentlyOnFrontendLoop(); | 284 void HandleStopSyncingPermanentlyOnFrontendLoop(); |
| 288 | 285 |
| 289 // Dispatched to from OnConnectionStatusChange to handle updating | 286 // Dispatched to from OnConnectionStatusChange to handle updating |
| 290 // frontend UI components. | 287 // frontend UI components. |
| 291 void HandleConnectionStatusChangeOnFrontendLoop( | 288 void HandleConnectionStatusChangeOnFrontendLoop( |
| 292 syncer::ConnectionStatus status); | 289 syncer::ConnectionStatus status); |
| 293 | 290 |
| 294 // NotificationObserver implementation. | 291 // NotificationObserver implementation. |
| 295 virtual void Observe( | 292 void Observe(int type, |
| 296 int type, | 293 const content::NotificationSource& source, |
| 297 const content::NotificationSource& source, | 294 const content::NotificationDetails& details) override; |
| 298 const content::NotificationDetails& details) override; | |
| 299 | 295 |
| 300 // InvalidationHandler implementation. | 296 // InvalidationHandler implementation. |
| 301 virtual void OnInvalidatorStateChange( | 297 void OnInvalidatorStateChange(syncer::InvalidatorState state) override; |
| 302 syncer::InvalidatorState state) override; | 298 void OnIncomingInvalidation( |
| 303 virtual void OnIncomingInvalidation( | |
| 304 const syncer::ObjectIdInvalidationMap& invalidation_map) override; | 299 const syncer::ObjectIdInvalidationMap& invalidation_map) override; |
| 305 virtual std::string GetOwnerName() const override; | 300 std::string GetOwnerName() const override; |
| 306 | 301 |
| 307 content::NotificationRegistrar notification_registrar_; | 302 content::NotificationRegistrar notification_registrar_; |
| 308 | 303 |
| 309 // A reference to the MessageLoop used to construct |this|, so we know how | 304 // A reference to the MessageLoop used to construct |this|, so we know how |
| 310 // to safely talk back to the SyncFrontend. | 305 // to safely talk back to the SyncFrontend. |
| 311 base::MessageLoop* const frontend_loop_; | 306 base::MessageLoop* const frontend_loop_; |
| 312 | 307 |
| 313 Profile* const profile_; | 308 Profile* const profile_; |
| 314 | 309 |
| 315 // Name used for debugging (set from profile_->GetDebugName()). | 310 // Name used for debugging (set from profile_->GetDebugName()). |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 357 |
| 363 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; | 358 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; |
| 364 | 359 |
| 365 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); | 360 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); |
| 366 }; | 361 }; |
| 367 | 362 |
| 368 } // namespace browser_sync | 363 } // namespace browser_sync |
| 369 | 364 |
| 370 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 365 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
| 371 | 366 |
| OLD | NEW |