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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // |sync_prefs|. | 74 // |sync_prefs|. |
75 SyncBackendHostImpl(const std::string& name, | 75 SyncBackendHostImpl(const std::string& name, |
76 Profile* profile, | 76 Profile* profile, |
77 invalidation::InvalidationService* invalidator, | 77 invalidation::InvalidationService* invalidator, |
78 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 78 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |
79 const base::FilePath& sync_folder); | 79 const base::FilePath& sync_folder); |
80 virtual ~SyncBackendHostImpl(); | 80 virtual ~SyncBackendHostImpl(); |
81 | 81 |
82 // SyncBackendHost implementation. | 82 // SyncBackendHost implementation. |
83 virtual void Initialize( | 83 virtual void Initialize( |
84 SyncFrontend* frontend, | 84 sync_driver::SyncFrontend* frontend, |
85 scoped_ptr<base::Thread> sync_thread, | 85 scoped_ptr<base::Thread> sync_thread, |
86 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 86 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
87 const GURL& service_url, | 87 const GURL& service_url, |
88 const syncer::SyncCredentials& credentials, | 88 const syncer::SyncCredentials& credentials, |
89 bool delete_sync_data_folder, | 89 bool delete_sync_data_folder, |
90 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 90 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
91 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, | 91 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, |
92 syncer::ReportUnrecoverableErrorFunction | 92 syncer::ReportUnrecoverableErrorFunction |
93 report_unrecoverable_error_function, | 93 report_unrecoverable_error_function, |
94 syncer::NetworkResources* network_resources) OVERRIDE; | 94 syncer::NetworkResources* network_resources) OVERRIDE; |
95 virtual void UpdateCredentials( | 95 virtual void UpdateCredentials( |
96 const syncer::SyncCredentials& credentials) OVERRIDE; | 96 const syncer::SyncCredentials& credentials) OVERRIDE; |
97 virtual void StartSyncingWithServer() OVERRIDE; | 97 virtual void StartSyncingWithServer() OVERRIDE; |
98 virtual void SetEncryptionPassphrase( | 98 virtual void SetEncryptionPassphrase( |
99 const std::string& passphrase, | 99 const std::string& passphrase, |
100 bool is_explicit) OVERRIDE; | 100 bool is_explicit) OVERRIDE; |
101 virtual bool SetDecryptionPassphrase(const std::string& passphrase) | 101 virtual bool SetDecryptionPassphrase(const std::string& passphrase) |
102 OVERRIDE WARN_UNUSED_RESULT; | 102 OVERRIDE WARN_UNUSED_RESULT; |
103 virtual void StopSyncingForShutdown() OVERRIDE; | 103 virtual void StopSyncingForShutdown() OVERRIDE; |
104 virtual scoped_ptr<base::Thread> Shutdown(ShutdownOption option) OVERRIDE; | 104 virtual scoped_ptr<base::Thread> Shutdown(ShutdownOption option) OVERRIDE; |
105 virtual void UnregisterInvalidationIds() OVERRIDE; | 105 virtual void UnregisterInvalidationIds() OVERRIDE; |
106 virtual void ConfigureDataTypes( | 106 virtual void ConfigureDataTypes( |
107 syncer::ConfigureReason reason, | 107 syncer::ConfigureReason reason, |
108 const DataTypeConfigStateMap& config_state_map, | 108 const DataTypeConfigStateMap& config_state_map, |
109 const base::Callback<void(syncer::ModelTypeSet, | 109 const base::Callback<void(syncer::ModelTypeSet, |
110 syncer::ModelTypeSet)>& ready_task, | 110 syncer::ModelTypeSet)>& ready_task, |
111 const base::Callback<void()>& retry_callback) OVERRIDE; | 111 const base::Callback<void()>& retry_callback) OVERRIDE; |
112 virtual void ActivateDataType( | 112 virtual void ActivateDataType( |
113 syncer::ModelType type, syncer::ModelSafeGroup group, | 113 syncer::ModelType type, syncer::ModelSafeGroup group, |
114 ChangeProcessor* change_processor) OVERRIDE; | 114 sync_driver::ChangeProcessor* change_processor) OVERRIDE; |
115 virtual void DeactivateDataType(syncer::ModelType type) OVERRIDE; | 115 virtual void DeactivateDataType(syncer::ModelType type) OVERRIDE; |
116 virtual void EnableEncryptEverything() OVERRIDE; | 116 virtual void EnableEncryptEverything() OVERRIDE; |
117 virtual syncer::UserShare* GetUserShare() const OVERRIDE; | 117 virtual syncer::UserShare* GetUserShare() const OVERRIDE; |
118 virtual scoped_ptr<syncer::SyncContextProxy> GetSyncContextProxy() OVERRIDE; | 118 virtual scoped_ptr<syncer::SyncContextProxy> GetSyncContextProxy() OVERRIDE; |
119 virtual Status GetDetailedStatus() OVERRIDE; | 119 virtual Status GetDetailedStatus() OVERRIDE; |
120 virtual syncer::sessions::SyncSessionSnapshot | 120 virtual syncer::sessions::SyncSessionSnapshot |
121 GetLastSessionSnapshot() const OVERRIDE; | 121 GetLastSessionSnapshot() const OVERRIDE; |
122 virtual bool HasUnsyncedItems() const OVERRIDE; | 122 virtual bool HasUnsyncedItems() const OVERRIDE; |
123 virtual bool IsNigoriEnabled() const OVERRIDE; | 123 virtual bool IsNigoriEnabled() const OVERRIDE; |
124 virtual syncer::PassphraseType GetPassphraseType() const OVERRIDE; | 124 virtual syncer::PassphraseType GetPassphraseType() const OVERRIDE; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 syncer::ModelType type, | 202 syncer::ModelType type, |
203 const syncer::UpdateCounters& counters); | 203 const syncer::UpdateCounters& counters); |
204 | 204 |
205 // Forwards a directory status counter update to the frontend loop. Will not | 205 // Forwards a directory status counter update to the frontend loop. Will not |
206 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding() | 206 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding() |
207 // explicitly requested that we start forwarding these events. | 207 // explicitly requested that we start forwarding these events. |
208 void HandleDirectoryStatusCountersUpdatedOnFrontendLoop( | 208 void HandleDirectoryStatusCountersUpdatedOnFrontendLoop( |
209 syncer::ModelType type, | 209 syncer::ModelType type, |
210 const syncer::StatusCounters& counters); | 210 const syncer::StatusCounters& counters); |
211 | 211 |
212 SyncFrontend* frontend() { return frontend_; } | 212 sync_driver::SyncFrontend* frontend() { return frontend_; } |
213 | 213 |
214 private: | 214 private: |
215 friend class SyncBackendHostCore; | 215 friend class SyncBackendHostCore; |
216 | 216 |
217 // Checks if we have received a notice to turn on experimental datatypes | 217 // Checks if we have received a notice to turn on experimental datatypes |
218 // (via the nigori node) and informs the frontend if that is the case. | 218 // (via the nigori node) and informs the frontend if that is the case. |
219 // Note: it is illegal to call this before the backend is initialized. | 219 // Note: it is illegal to call this before the backend is initialized. |
220 void AddExperimentalTypes(); | 220 void AddExperimentalTypes(); |
221 | 221 |
222 // Handles backend initialization failure. | 222 // Handles backend initialization failure. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 bool initialized_; | 329 bool initialized_; |
330 | 330 |
331 const base::WeakPtr<sync_driver::SyncPrefs> sync_prefs_; | 331 const base::WeakPtr<sync_driver::SyncPrefs> sync_prefs_; |
332 | 332 |
333 ExtensionsActivityMonitor extensions_activity_monitor_; | 333 ExtensionsActivityMonitor extensions_activity_monitor_; |
334 | 334 |
335 scoped_ptr<SyncBackendRegistrar> registrar_; | 335 scoped_ptr<SyncBackendRegistrar> registrar_; |
336 | 336 |
337 // The frontend which we serve (and are owned by). | 337 // The frontend which we serve (and are owned by). |
338 SyncFrontend* frontend_; | 338 sync_driver::SyncFrontend* frontend_; |
339 | 339 |
340 // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired | 340 // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired |
341 // is called. This way, before the UI calls SetDecryptionPassphrase on the | 341 // is called. This way, before the UI calls SetDecryptionPassphrase on the |
342 // syncer, it can avoid the overhead of an asynchronous decryption call and | 342 // syncer, it can avoid the overhead of an asynchronous decryption call and |
343 // give the user immediate feedback about the passphrase entered by first | 343 // give the user immediate feedback about the passphrase entered by first |
344 // trying to decrypt the cached pending keys on the UI thread. Note that | 344 // trying to decrypt the cached pending keys on the UI thread. Note that |
345 // SetDecryptionPassphrase can still fail after the cached pending keys are | 345 // SetDecryptionPassphrase can still fail after the cached pending keys are |
346 // successfully decrypted if the pending keys have changed since the time they | 346 // successfully decrypted if the pending keys have changed since the time they |
347 // were cached. | 347 // were cached. |
348 sync_pb::EncryptedData cached_pending_keys_; | 348 sync_pb::EncryptedData cached_pending_keys_; |
(...skipping 16 matching lines...) Expand all Loading... |
365 | 365 |
366 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; | 366 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; |
367 | 367 |
368 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); | 368 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); |
369 }; | 369 }; |
370 | 370 |
371 } // namespace browser_sync | 371 } // namespace browser_sync |
372 | 372 |
373 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 373 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
374 | 374 |
OLD | NEW |