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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 syncer::ModelType type, | 203 syncer::ModelType type, |
204 const syncer::UpdateCounters& counters); | 204 const syncer::UpdateCounters& counters); |
205 | 205 |
206 // Forwards a directory status counter update to the frontend loop. Will not | 206 // Forwards a directory status counter update to the frontend loop. Will not |
207 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding() | 207 // be called unless a call to EnableDirectoryTypeDebugInfoForwarding() |
208 // explicitly requested that we start forwarding these events. | 208 // explicitly requested that we start forwarding these events. |
209 void HandleDirectoryStatusCountersUpdatedOnFrontendLoop( | 209 void HandleDirectoryStatusCountersUpdatedOnFrontendLoop( |
210 syncer::ModelType type, | 210 syncer::ModelType type, |
211 const syncer::StatusCounters& counters); | 211 const syncer::StatusCounters& counters); |
212 | 212 |
213 SyncFrontend* frontend() { return frontend_; } | 213 sync_driver::SyncFrontend* frontend() { return frontend_; } |
214 | 214 |
215 private: | 215 private: |
216 friend class SyncBackendHostCore; | 216 friend class SyncBackendHostCore; |
217 | 217 |
218 // Checks if we have received a notice to turn on experimental datatypes | 218 // Checks if we have received a notice to turn on experimental datatypes |
219 // (via the nigori node) and informs the frontend if that is the case. | 219 // (via the nigori node) and informs the frontend if that is the case. |
220 // Note: it is illegal to call this before the backend is initialized. | 220 // Note: it is illegal to call this before the backend is initialized. |
221 void AddExperimentalTypes(); | 221 void AddExperimentalTypes(); |
222 | 222 |
223 // Handles backend initialization failure. | 223 // Handles backend initialization failure. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 bool initialized_; | 330 bool initialized_; |
331 | 331 |
332 const base::WeakPtr<sync_driver::SyncPrefs> sync_prefs_; | 332 const base::WeakPtr<sync_driver::SyncPrefs> sync_prefs_; |
333 | 333 |
334 ExtensionsActivityMonitor extensions_activity_monitor_; | 334 ExtensionsActivityMonitor extensions_activity_monitor_; |
335 | 335 |
336 scoped_ptr<SyncBackendRegistrar> registrar_; | 336 scoped_ptr<SyncBackendRegistrar> registrar_; |
337 | 337 |
338 // The frontend which we serve (and are owned by). | 338 // The frontend which we serve (and are owned by). |
339 SyncFrontend* frontend_; | 339 sync_driver::SyncFrontend* frontend_; |
340 | 340 |
341 // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired | 341 // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired |
342 // is called. This way, before the UI calls SetDecryptionPassphrase on the | 342 // is called. This way, before the UI calls SetDecryptionPassphrase on the |
343 // syncer, it can avoid the overhead of an asynchronous decryption call and | 343 // syncer, it can avoid the overhead of an asynchronous decryption call and |
344 // give the user immediate feedback about the passphrase entered by first | 344 // give the user immediate feedback about the passphrase entered by first |
345 // trying to decrypt the cached pending keys on the UI thread. Note that | 345 // trying to decrypt the cached pending keys on the UI thread. Note that |
346 // SetDecryptionPassphrase can still fail after the cached pending keys are | 346 // SetDecryptionPassphrase can still fail after the cached pending keys are |
347 // successfully decrypted if the pending keys have changed since the time they | 347 // successfully decrypted if the pending keys have changed since the time they |
348 // were cached. | 348 // were cached. |
349 sync_pb::EncryptedData cached_pending_keys_; | 349 sync_pb::EncryptedData cached_pending_keys_; |
(...skipping 16 matching lines...) Expand all Loading... |
366 | 366 |
367 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; | 367 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; |
368 | 368 |
369 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); | 369 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); |
370 }; | 370 }; |
371 | 371 |
372 } // namespace browser_sync | 372 } // namespace browser_sync |
373 | 373 |
374 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 374 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
375 | 375 |
OLD | NEW |