Chromium Code Reviews| 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" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "sync/internal_api/public/sync_manager_factory.h" | 21 #include "sync/internal_api/public/sync_manager_factory.h" |
| 22 #include "sync/internal_api/public/util/weak_handle.h" | 22 #include "sync/internal_api/public/util/weak_handle.h" |
| 23 | 23 |
| 24 class GURL; | 24 class GURL; |
| 25 | 25 |
| 26 namespace base { | 26 namespace base { |
| 27 class MessageLoop; | 27 class MessageLoop; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace syncer { | 30 namespace syncer { |
| 31 class NetworkResources; | 31 class CancelationSignal; |
| 32 class HttpPostProviderFactory; | |
| 32 class SyncManagerFactory; | 33 class SyncManagerFactory; |
| 33 class UnrecoverableErrorHandler; | 34 class UnrecoverableErrorHandler; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace sync_driver { | 37 namespace sync_driver { |
| 37 class ChangeProcessor; | 38 class ChangeProcessor; |
| 38 class SyncFrontend; | 39 class SyncFrontend; |
| 39 } | 40 } |
| 40 | 41 |
| 41 namespace browser_sync { | 42 namespace browser_sync { |
| 42 | 43 |
| 43 // An API to "host" the top level SyncAPI element. | 44 // An API to "host" the top level SyncAPI element. |
| 44 // | 45 // |
| 45 // This class handles dispatch of potentially blocking calls to appropriate | 46 // This class handles dispatch of potentially blocking calls to appropriate |
| 46 // 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. |
| 47 class SyncBackendHost : public sync_driver::BackendDataTypeConfigurer { | 48 class SyncBackendHost : public sync_driver::BackendDataTypeConfigurer { |
| 48 public: | 49 public: |
| 49 typedef syncer::SyncStatus Status; | 50 typedef syncer::SyncStatus Status; |
| 51 typedef base::Callback<scoped_ptr<syncer::HttpPostProviderFactory>( | |
| 52 syncer::CancelationSignal*)> HttpPostProviderFactoryGetter; | |
| 50 | 53 |
| 51 // Stubs used by implementing classes. | 54 // Stubs used by implementing classes. |
| 52 SyncBackendHost(); | 55 SyncBackendHost(); |
| 53 ~SyncBackendHost() override; | 56 ~SyncBackendHost() override; |
| 54 | 57 |
| 55 // Called on the frontend's thread to kick off asynchronous initialization. | 58 // Called on the frontend's thread to kick off asynchronous initialization. |
| 56 // Optionally deletes the "Sync Data" folder during init in order to make | 59 // Optionally deletes the "Sync Data" folder during init in order to make |
| 57 // sure we're starting fresh. | 60 // sure we're starting fresh. |
| 58 // | 61 // |
| 59 // |saved_nigori_state| is optional nigori state to restore from a previous | 62 // |saved_nigori_state| is optional nigori state to restore from a previous |
| 60 // backend instance. May be null. | 63 // backend instance. May be null. |
| 61 virtual void Initialize( | 64 virtual void Initialize( |
| 62 sync_driver::SyncFrontend* frontend, | 65 sync_driver::SyncFrontend* frontend, |
| 63 scoped_ptr<base::Thread> sync_thread, | 66 scoped_ptr<base::Thread> sync_thread, |
| 64 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 67 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 65 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, | 68 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, |
| 66 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 69 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
| 67 const GURL& service_url, | 70 const GURL& service_url, |
| 68 const std::string& sync_user_agent, | 71 const std::string& sync_user_agent, |
| 69 const syncer::SyncCredentials& credentials, | 72 const syncer::SyncCredentials& credentials, |
| 70 bool delete_sync_data_folder, | 73 bool delete_sync_data_folder, |
| 71 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 74 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 72 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& | 75 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
| 73 unrecoverable_error_handler, | 76 unrecoverable_error_handler, |
| 74 const base::Closure& report_unrecoverable_error_function, | 77 const base::Closure& report_unrecoverable_error_function, |
| 75 syncer::NetworkResources* network_resources, | 78 const HttpPostProviderFactoryGetter& get_http_post_provider_factory, |
|
Nicolas Zea
2015/10/27 20:41:42
nit: prefer calling this http_post_provider_factor
maxbogue
2015/10/27 23:53:08
Ah, my habit when naming function vars is verbs, b
| |
| 76 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> | 79 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> |
| 77 saved_nigori_state) = 0; | 80 saved_nigori_state) = 0; |
| 78 | 81 |
| 79 // Called on the frontend's thread to trigger a refresh. | 82 // Called on the frontend's thread to trigger a refresh. |
| 80 virtual void TriggerRefresh(const syncer::ModelTypeSet& types) = 0; | 83 virtual void TriggerRefresh(const syncer::ModelTypeSet& types) = 0; |
| 81 | 84 |
| 82 // Called on the frontend's thread to update SyncCredentials. | 85 // Called on the frontend's thread to update SyncCredentials. |
| 83 virtual void UpdateCredentials( | 86 virtual void UpdateCredentials( |
| 84 const syncer::SyncCredentials& credentials) = 0; | 87 const syncer::SyncCredentials& credentials) = 0; |
| 85 | 88 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 // See SyncManager::ClearServerData. | 226 // See SyncManager::ClearServerData. |
| 224 virtual void ClearServerData( | 227 virtual void ClearServerData( |
| 225 const syncer::SyncManager::ClearServerDataCallback& callback) = 0; | 228 const syncer::SyncManager::ClearServerDataCallback& callback) = 0; |
| 226 | 229 |
| 227 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 230 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 228 }; | 231 }; |
| 229 | 232 |
| 230 } // namespace browser_sync | 233 } // namespace browser_sync |
| 231 | 234 |
| 232 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 235 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |