| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // process changes. | 51 // process changes. |
| 52 virtual void OnBackendInitialized() = 0; | 52 virtual void OnBackendInitialized() = 0; |
| 53 | 53 |
| 54 // The backend queried the server recently and received some updates. | 54 // The backend queried the server recently and received some updates. |
| 55 virtual void OnSyncCycleCompleted() = 0; | 55 virtual void OnSyncCycleCompleted() = 0; |
| 56 | 56 |
| 57 // The backend encountered an authentication problem and requests new | 57 // The backend encountered an authentication problem and requests new |
| 58 // credentials to be provided. See SyncBackendHost::Authenticate for details. | 58 // credentials to be provided. See SyncBackendHost::Authenticate for details. |
| 59 virtual void OnAuthError() = 0; | 59 virtual void OnAuthError() = 0; |
| 60 | 60 |
| 61 // We are no longer permitted to communicate with the server. Sync should |
| 62 // be disabled and state cleaned up at once. |
| 63 virtual void OnStopSyncingPermanently() = 0; |
| 64 |
| 61 protected: | 65 protected: |
| 62 // Don't delete through SyncFrontend interface. | 66 // Don't delete through SyncFrontend interface. |
| 63 virtual ~SyncFrontend() { | 67 virtual ~SyncFrontend() { |
| 64 } | 68 } |
| 65 private: | 69 private: |
| 66 DISALLOW_COPY_AND_ASSIGN(SyncFrontend); | 70 DISALLOW_COPY_AND_ASSIGN(SyncFrontend); |
| 67 }; | 71 }; |
| 68 | 72 |
| 69 // A UI-thread safe API into the sync backend that "hosts" the top-level | 73 // A UI-thread safe API into the sync backend that "hosts" the top-level |
| 70 // syncapi element, the SyncManager, on its own thread. This class handles | 74 // syncapi element, the SyncManager, on its own thread. This class handles |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 const sync_api::SyncManager::ChangeRecord* changes, | 227 const sync_api::SyncManager::ChangeRecord* changes, |
| 224 int change_count); | 228 int change_count); |
| 225 virtual void OnSyncCycleCompleted( | 229 virtual void OnSyncCycleCompleted( |
| 226 const sessions::SyncSessionSnapshot* snapshot); | 230 const sessions::SyncSessionSnapshot* snapshot); |
| 227 virtual void OnInitializationComplete(); | 231 virtual void OnInitializationComplete(); |
| 228 virtual void OnAuthError(const GoogleServiceAuthError& auth_error); | 232 virtual void OnAuthError(const GoogleServiceAuthError& auth_error); |
| 229 virtual void OnPassphraseRequired(); | 233 virtual void OnPassphraseRequired(); |
| 230 virtual void OnPassphraseAccepted(); | 234 virtual void OnPassphraseAccepted(); |
| 231 virtual void OnPaused(); | 235 virtual void OnPaused(); |
| 232 virtual void OnResumed(); | 236 virtual void OnResumed(); |
| 237 virtual void OnStopSyncingPermanently(); |
| 233 | 238 |
| 234 struct DoInitializeOptions { | 239 struct DoInitializeOptions { |
| 235 DoInitializeOptions( | 240 DoInitializeOptions( |
| 236 const GURL& service_url, | 241 const GURL& service_url, |
| 237 bool attempt_last_user_authentication, | 242 bool attempt_last_user_authentication, |
| 238 sync_api::HttpPostProviderFactory* http_bridge_factory, | 243 sync_api::HttpPostProviderFactory* http_bridge_factory, |
| 239 sync_api::HttpPostProviderFactory* auth_http_bridge_factory, | 244 sync_api::HttpPostProviderFactory* auth_http_bridge_factory, |
| 240 const std::string& lsid, | 245 const std::string& lsid, |
| 241 bool delete_sync_data_folder, | 246 bool delete_sync_data_folder, |
| 242 bool invalidate_sync_login, | 247 bool invalidate_sync_login, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 void NotifyPassphraseRequired(); | 372 void NotifyPassphraseRequired(); |
| 368 | 373 |
| 369 // Invoked when the passphrase provided by the user has been accepted. | 374 // Invoked when the passphrase provided by the user has been accepted. |
| 370 void NotifyPassphraseAccepted(); | 375 void NotifyPassphraseAccepted(); |
| 371 | 376 |
| 372 // Called from Core::OnSyncCycleCompleted to handle updating frontend | 377 // Called from Core::OnSyncCycleCompleted to handle updating frontend |
| 373 // thread components. | 378 // thread components. |
| 374 void HandleSyncCycleCompletedOnFrontendLoop( | 379 void HandleSyncCycleCompletedOnFrontendLoop( |
| 375 sessions::SyncSessionSnapshot* snapshot); | 380 sessions::SyncSessionSnapshot* snapshot); |
| 376 | 381 |
| 382 void HandleStopSyncingPermanentlyOnFrontendLoop(); |
| 383 |
| 377 // Called from Core::OnInitializationComplete to handle updating | 384 // Called from Core::OnInitializationComplete to handle updating |
| 378 // frontend thread components. | 385 // frontend thread components. |
| 379 void HandleInitalizationCompletedOnFrontendLoop(); | 386 void HandleInitalizationCompletedOnFrontendLoop(); |
| 380 | 387 |
| 381 // Return true if a model lives on the current thread. | 388 // Return true if a model lives on the current thread. |
| 382 bool IsCurrentThreadSafeForModel(syncable::ModelType model_type); | 389 bool IsCurrentThreadSafeForModel(syncable::ModelType model_type); |
| 383 | 390 |
| 384 // Our parent SyncBackendHost | 391 // Our parent SyncBackendHost |
| 385 SyncBackendHost* host_; | 392 SyncBackendHost* host_; |
| 386 | 393 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 469 |
| 463 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 470 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
| 464 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 471 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; |
| 465 | 472 |
| 466 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 473 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 467 }; | 474 }; |
| 468 | 475 |
| 469 } // namespace browser_sync | 476 } // namespace browser_sync |
| 470 | 477 |
| 471 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 478 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |