| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "components/sync_driver/backend_data_type_configurer.h" | 15 #include "components/sync_driver/backend_data_type_configurer.h" |
| 16 #include "sync/internal_api/public/base/model_type.h" | 16 #include "sync/internal_api/public/base/model_type.h" |
| 17 #include "sync/internal_api/public/configure_reason.h" | 17 #include "sync/internal_api/public/configure_reason.h" |
| 18 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 18 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
| 19 #include "sync/internal_api/public/shutdown_reason.h" | 19 #include "sync/internal_api/public/shutdown_reason.h" |
| 20 #include "sync/internal_api/public/sync_context_proxy.h" | 20 #include "sync/internal_api/public/sync_context_proxy.h" |
| 21 #include "sync/internal_api/public/sync_manager.h" | 21 #include "sync/internal_api/public/sync_manager.h" |
| 22 #include "sync/internal_api/public/sync_manager_factory.h" | 22 #include "sync/internal_api/public/sync_manager_factory.h" |
| 23 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | |
| 24 #include "sync/internal_api/public/util/weak_handle.h" | 23 #include "sync/internal_api/public/util/weak_handle.h" |
| 25 | 24 |
| 26 class GURL; | 25 class GURL; |
| 27 | 26 |
| 28 namespace base { | 27 namespace base { |
| 29 class MessageLoop; | 28 class MessageLoop; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace syncer { | 31 namespace syncer { |
| 33 class NetworkResources; | 32 class NetworkResources; |
| 34 class SyncManagerFactory; | 33 class SyncManagerFactory; |
| 34 class UnrecoverableErrorHandler; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace sync_driver { | 37 namespace sync_driver { |
| 38 class ChangeProcessor; | 38 class ChangeProcessor; |
| 39 class SyncFrontend; | 39 class SyncFrontend; |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace browser_sync { | 42 namespace browser_sync { |
| 43 | 43 |
| 44 // An API to "host" the top level SyncAPI element. | 44 // An API to "host" the top level SyncAPI element. |
| 45 // | 45 // |
| 46 // This class handles dispatch of potentially blocking calls to appropriate | 46 // This class handles dispatch of potentially blocking calls to appropriate |
| 47 // threads and ensures that the SyncFrontend is only accessed on the UI loop. | 47 // threads and ensures that the SyncFrontend is only accessed on the UI loop. |
| 48 class SyncBackendHost : public sync_driver::BackendDataTypeConfigurer { | 48 class SyncBackendHost : public sync_driver::BackendDataTypeConfigurer { |
| 49 public: | 49 public: |
| 50 typedef syncer::SyncStatus Status; | 50 typedef syncer::SyncStatus Status; |
| 51 | 51 |
| 52 // Stubs used by implementing classes. | 52 // Stubs used by implementing classes. |
| 53 SyncBackendHost(); | 53 SyncBackendHost(); |
| 54 ~SyncBackendHost() override; | 54 ~SyncBackendHost() override; |
| 55 | 55 |
| 56 // Called on the frontend's thread to kick off asynchronous initialization. | 56 // Called on the frontend's thread to kick off asynchronous initialization. |
| 57 // Optionally deletes the "Sync Data" folder during init in order to make | 57 // Optionally deletes the "Sync Data" folder during init in order to make |
| 58 // sure we're starting fresh. | 58 // sure we're starting fresh. |
| 59 // | 59 // |
| 60 // Note: |unrecoverable_error_handler| may be invoked from any thread. | |
| 61 // | |
| 62 // |saved_nigori_state| is optional nigori state to restore from a previous | 60 // |saved_nigori_state| is optional nigori state to restore from a previous |
| 63 // backend instance. May be null. | 61 // backend instance. May be null. |
| 64 virtual void Initialize( | 62 virtual void Initialize( |
| 65 sync_driver::SyncFrontend* frontend, | 63 sync_driver::SyncFrontend* frontend, |
| 66 scoped_ptr<base::Thread> sync_thread, | 64 scoped_ptr<base::Thread> sync_thread, |
| 67 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 65 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
| 68 const GURL& service_url, | 66 const GURL& service_url, |
| 69 const syncer::SyncCredentials& credentials, | 67 const syncer::SyncCredentials& credentials, |
| 70 bool delete_sync_data_folder, | 68 bool delete_sync_data_folder, |
| 71 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 69 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 72 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, | 70 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
| 71 unrecoverable_error_handler, |
| 73 const base::Closure& report_unrecoverable_error_function, | 72 const base::Closure& report_unrecoverable_error_function, |
| 74 syncer::NetworkResources* network_resources, | 73 syncer::NetworkResources* network_resources, |
| 75 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> | 74 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> |
| 76 saved_nigori_state) = 0; | 75 saved_nigori_state) = 0; |
| 77 | 76 |
| 78 // Called on the frontend's thread to update SyncCredentials. | 77 // Called on the frontend's thread to update SyncCredentials. |
| 79 virtual void UpdateCredentials( | 78 virtual void UpdateCredentials( |
| 80 const syncer::SyncCredentials& credentials) = 0; | 79 const syncer::SyncCredentials& credentials) = 0; |
| 81 | 80 |
| 82 // This starts the SyncerThread running a Syncer object to communicate with | 81 // This starts the SyncerThread running a Syncer object to communicate with |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // See SyncManager::ClearServerData. | 224 // See SyncManager::ClearServerData. |
| 226 virtual void ClearServerData( | 225 virtual void ClearServerData( |
| 227 const syncer::SyncManager::ClearServerDataCallback& callback) = 0; | 226 const syncer::SyncManager::ClearServerDataCallback& callback) = 0; |
| 228 | 227 |
| 229 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 228 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 230 }; | 229 }; |
| 231 | 230 |
| 232 } // namespace browser_sync | 231 } // namespace browser_sync |
| 233 | 232 |
| 234 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 233 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |