| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const syncer::SyncCredentials& credentials) OVERRIDE; | 93 const syncer::SyncCredentials& credentials) OVERRIDE; |
| 94 virtual void StartSyncingWithServer() OVERRIDE; | 94 virtual void StartSyncingWithServer() OVERRIDE; |
| 95 virtual void SetEncryptionPassphrase( | 95 virtual void SetEncryptionPassphrase( |
| 96 const std::string& passphrase, | 96 const std::string& passphrase, |
| 97 bool is_explicit) OVERRIDE; | 97 bool is_explicit) OVERRIDE; |
| 98 virtual bool SetDecryptionPassphrase(const std::string& passphrase) | 98 virtual bool SetDecryptionPassphrase(const std::string& passphrase) |
| 99 OVERRIDE WARN_UNUSED_RESULT; | 99 OVERRIDE WARN_UNUSED_RESULT; |
| 100 virtual void StopSyncingForShutdown() OVERRIDE; | 100 virtual void StopSyncingForShutdown() OVERRIDE; |
| 101 virtual scoped_ptr<base::Thread> Shutdown(ShutdownOption option) OVERRIDE; | 101 virtual scoped_ptr<base::Thread> Shutdown(ShutdownOption option) OVERRIDE; |
| 102 virtual void UnregisterInvalidationIds() OVERRIDE; | 102 virtual void UnregisterInvalidationIds() OVERRIDE; |
| 103 virtual void SetPreferredNonBlockingTypes( |
| 104 syncer::ModelTypeSet types) OVERRIDE; |
| 103 virtual void ConfigureDataTypes( | 105 virtual void ConfigureDataTypes( |
| 104 syncer::ConfigureReason reason, | 106 syncer::ConfigureReason reason, |
| 105 const DataTypeConfigStateMap& config_state_map, | 107 const DataTypeConfigStateMap& config_state_map, |
| 106 const base::Callback<void(syncer::ModelTypeSet, | 108 const base::Callback<void(syncer::ModelTypeSet, |
| 107 syncer::ModelTypeSet)>& ready_task, | 109 syncer::ModelTypeSet)>& ready_task, |
| 108 const base::Callback<void()>& retry_callback) OVERRIDE; | 110 const base::Callback<void()>& retry_callback) OVERRIDE; |
| 109 virtual void EnableEncryptEverything() OVERRIDE; | 111 virtual void EnableEncryptEverything() OVERRIDE; |
| 110 virtual void ActivateDataType( | 112 virtual void ActivateDataType( |
| 111 syncer::ModelType type, syncer::ModelSafeGroup group, | 113 syncer::ModelType type, syncer::ModelSafeGroup group, |
| 112 ChangeProcessor* change_processor) OVERRIDE; | 114 ChangeProcessor* change_processor) OVERRIDE; |
| 113 virtual void DeactivateDataType(syncer::ModelType type) OVERRIDE; | 115 virtual void DeactivateDataType(syncer::ModelType type) OVERRIDE; |
| 114 virtual syncer::UserShare* GetUserShare() const OVERRIDE; | 116 virtual syncer::UserShare* GetUserShare() const OVERRIDE; |
| 117 virtual syncer::SyncCoreProxy GetSyncCoreProxy() OVERRIDE; |
| 115 virtual Status GetDetailedStatus() OVERRIDE; | 118 virtual Status GetDetailedStatus() OVERRIDE; |
| 116 virtual syncer::sessions::SyncSessionSnapshot | 119 virtual syncer::sessions::SyncSessionSnapshot |
| 117 GetLastSessionSnapshot() const OVERRIDE; | 120 GetLastSessionSnapshot() const OVERRIDE; |
| 118 virtual bool HasUnsyncedItems() const OVERRIDE; | 121 virtual bool HasUnsyncedItems() const OVERRIDE; |
| 119 virtual bool IsNigoriEnabled() const OVERRIDE; | 122 virtual bool IsNigoriEnabled() const OVERRIDE; |
| 120 virtual syncer::PassphraseType GetPassphraseType() const OVERRIDE; | 123 virtual syncer::PassphraseType GetPassphraseType() const OVERRIDE; |
| 121 virtual base::Time GetExplicitPassphraseTime() const OVERRIDE; | 124 virtual base::Time GetExplicitPassphraseTime() const OVERRIDE; |
| 122 virtual bool IsCryptographerReady( | 125 virtual bool IsCryptographerReady( |
| 123 const syncer::BaseTransaction* trans) const OVERRIDE; | 126 const syncer::BaseTransaction* trans) const OVERRIDE; |
| 124 virtual void GetModelSafeRoutingInfo( | 127 virtual void GetModelSafeRoutingInfo( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 154 const syncer::ModelTypeSet succeeded_configuration_types, | 157 const syncer::ModelTypeSet succeeded_configuration_types, |
| 155 const syncer::ModelTypeSet failed_configuration_types, | 158 const syncer::ModelTypeSet failed_configuration_types, |
| 156 const base::Callback<void(syncer::ModelTypeSet, | 159 const base::Callback<void(syncer::ModelTypeSet, |
| 157 syncer::ModelTypeSet)>& ready_task); | 160 syncer::ModelTypeSet)>& ready_task); |
| 158 | 161 |
| 159 // Reports backend initialization success. Includes some objects from sync | 162 // Reports backend initialization success. Includes some objects from sync |
| 160 // manager initialization to be passed back to the UI thread. | 163 // manager initialization to be passed back to the UI thread. |
| 161 virtual void HandleInitializationSuccessOnFrontendLoop( | 164 virtual void HandleInitializationSuccessOnFrontendLoop( |
| 162 const syncer::WeakHandle<syncer::JsBackend> js_backend, | 165 const syncer::WeakHandle<syncer::JsBackend> js_backend, |
| 163 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener> | 166 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener> |
| 164 debug_info_listener); | 167 debug_info_listener, |
| 168 base::WeakPtr<syncer::SyncCore> sync_core); |
| 165 | 169 |
| 166 // Downloading of control types failed and will be retried. Invokes the | 170 // Downloading of control types failed and will be retried. Invokes the |
| 167 // frontend's sync configure retry method. | 171 // frontend's sync configure retry method. |
| 168 void HandleControlTypesDownloadRetry(); | 172 void HandleControlTypesDownloadRetry(); |
| 169 | 173 |
| 170 // Forwards a ProtocolEvent to the frontend. Will not be called unless a | 174 // Forwards a ProtocolEvent to the frontend. Will not be called unless a |
| 171 // call to SetForwardProtocolEvents() explicitly requested that we start | 175 // call to SetForwardProtocolEvents() explicitly requested that we start |
| 172 // forwarding these events. | 176 // forwarding these events. |
| 173 void HandleProtocolEventOnFrontendLoop(syncer::ProtocolEvent* event); | 177 void HandleProtocolEventOnFrontendLoop(syncer::ProtocolEvent* event); |
| 174 | 178 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 syncer::PassphraseType type, | 254 syncer::PassphraseType type, |
| 251 base::Time explicit_passphrase_time); | 255 base::Time explicit_passphrase_time); |
| 252 | 256 |
| 253 void HandleStopSyncingPermanentlyOnFrontendLoop(); | 257 void HandleStopSyncingPermanentlyOnFrontendLoop(); |
| 254 | 258 |
| 255 // Dispatched to from OnConnectionStatusChange to handle updating | 259 // Dispatched to from OnConnectionStatusChange to handle updating |
| 256 // frontend UI components. | 260 // frontend UI components. |
| 257 void HandleConnectionStatusChangeOnFrontendLoop( | 261 void HandleConnectionStatusChangeOnFrontendLoop( |
| 258 syncer::ConnectionStatus status); | 262 syncer::ConnectionStatus status); |
| 259 | 263 |
| 264 // Re-registers the appropriate set of ObjectIds with the invalidator. |
| 265 void UpdateRegisteredInvalidationTypes(); |
| 266 |
| 260 // NotificationObserver implementation. | 267 // NotificationObserver implementation. |
| 261 virtual void Observe( | 268 virtual void Observe( |
| 262 int type, | 269 int type, |
| 263 const content::NotificationSource& source, | 270 const content::NotificationSource& source, |
| 264 const content::NotificationDetails& details) OVERRIDE; | 271 const content::NotificationDetails& details) OVERRIDE; |
| 265 | 272 |
| 266 // InvalidationHandler implementation. | 273 // InvalidationHandler implementation. |
| 267 virtual void OnInvalidatorStateChange( | 274 virtual void OnInvalidatorStateChange( |
| 268 syncer::InvalidatorState state) OVERRIDE; | 275 syncer::InvalidatorState state) OVERRIDE; |
| 269 virtual void OnIncomingInvalidation( | 276 virtual void OnIncomingInvalidation( |
| 270 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE; | 277 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE; |
| 271 virtual std::string GetOwnerName() const OVERRIDE; | 278 virtual std::string GetOwnerName() const OVERRIDE; |
| 272 | 279 |
| 273 content::NotificationRegistrar notification_registrar_; | 280 content::NotificationRegistrar notification_registrar_; |
| 274 | 281 |
| 275 // A reference to the MessageLoop used to construct |this|, so we know how | 282 // A reference to the MessageLoop used to construct |this|, so we know how |
| 276 // to safely talk back to the SyncFrontend. | 283 // to safely talk back to the SyncFrontend. |
| 277 base::MessageLoop* const frontend_loop_; | 284 base::MessageLoop* const frontend_loop_; |
| 278 | 285 |
| 279 Profile* const profile_; | 286 Profile* const profile_; |
| 280 | 287 |
| 281 // Name used for debugging (set from profile_->GetDebugName()). | 288 // Name used for debugging (set from profile_->GetDebugName()). |
| 282 const std::string name_; | 289 const std::string name_; |
| 283 | 290 |
| 284 // Our core, which communicates directly to the syncapi. Use refptr instead | 291 // Our core, which communicates directly to the syncapi. Use refptr instead |
| 285 // of WeakHandle because |core_| is created on UI loop but released on | 292 // of WeakHandle because |core_| is created on UI loop but released on |
| 286 // sync loop. | 293 // sync loop. |
| 287 scoped_refptr<SyncBackendHostCore> core_; | 294 scoped_refptr<SyncBackendHostCore> core_; |
| 288 | 295 |
| 296 // A handle referencing the main interface for non-blocking sync types. |
| 297 scoped_ptr<syncer::SyncCoreProxy> sync_core_proxy_; |
| 298 |
| 289 bool initialized_; | 299 bool initialized_; |
| 290 | 300 |
| 291 const base::WeakPtr<sync_driver::SyncPrefs> sync_prefs_; | 301 const base::WeakPtr<sync_driver::SyncPrefs> sync_prefs_; |
| 292 | 302 |
| 293 ExtensionsActivityMonitor extensions_activity_monitor_; | 303 ExtensionsActivityMonitor extensions_activity_monitor_; |
| 294 | 304 |
| 295 scoped_ptr<SyncBackendRegistrar> registrar_; | 305 scoped_ptr<SyncBackendRegistrar> registrar_; |
| 296 | 306 |
| 297 // The frontend which we serve (and are owned by). | 307 // The frontend which we serve (and are owned by). |
| 298 SyncFrontend* frontend_; | 308 SyncFrontend* frontend_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 316 // If an explicit passphrase is in use, the time at which the passphrase was | 326 // If an explicit passphrase is in use, the time at which the passphrase was |
| 317 // first set (if available). | 327 // first set (if available). |
| 318 base::Time cached_explicit_passphrase_time_; | 328 base::Time cached_explicit_passphrase_time_; |
| 319 | 329 |
| 320 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 330 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
| 321 syncer::sessions::SyncSessionSnapshot last_snapshot_; | 331 syncer::sessions::SyncSessionSnapshot last_snapshot_; |
| 322 | 332 |
| 323 invalidation::InvalidationService* invalidator_; | 333 invalidation::InvalidationService* invalidator_; |
| 324 bool invalidation_handler_registered_; | 334 bool invalidation_handler_registered_; |
| 325 | 335 |
| 336 // The set of enabled directory types, as of the last successful configure. |
| 337 syncer::ModelTypeSet enabled_directory_types_; |
| 338 |
| 339 // The set of preferred non-blocking types, as set by the frontend. |
| 340 syncer::ModelTypeSet preferred_non_blocking_types_; |
| 341 |
| 326 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; | 342 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; |
| 327 | 343 |
| 328 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); | 344 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); |
| 329 }; | 345 }; |
| 330 | 346 |
| 331 } // namespace browser_sync | 347 } // namespace browser_sync |
| 332 | 348 |
| 333 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 349 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
| 334 | 350 |
| OLD | NEW |