Index: chrome/browser/sync/glue/sync_backend_host.h |
diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h |
index a77026b25b274d59b3df06253c4ea2ab6423ad34..3de9a815e3107922dd621f994fd19dcc7155ef51 100644 |
--- a/chrome/browser/sync/glue/sync_backend_host.h |
+++ b/chrome/browser/sync/glue/sync_backend_host.h |
@@ -25,6 +25,7 @@ |
#include "sync/internal_api/public/engine/model_safe_worker.h" |
#include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
#include "sync/internal_api/public/sync_manager.h" |
+#include "sync/internal_api/public/sync_manager_factory.h" |
#include "sync/internal_api/public/util/report_unrecoverable_error_function.h" |
#include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
#include "sync/internal_api/public/util/weak_handle.h" |
@@ -170,6 +171,7 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
syncer::ModelTypeSet initial_types, |
const syncer::SyncCredentials& credentials, |
bool delete_sync_data_folder, |
+ syncer::SyncManagerFactory* sync_manager_factory, |
syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, |
syncer::ReportUnrecoverableErrorFunction |
report_unrecoverable_error_function); |
@@ -276,7 +278,7 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
// TODO(akalin): Figure out a better way for tests to hook into |
// SyncBackendHost. |
- typedef base::Callback<syncer::HttpPostProviderFactory*(void)> |
+ typedef base::Callback<scoped_ptr<syncer::HttpPostProviderFactory>(void)> |
MakeHttpBridgeFactoryFn; |
struct DoInitializeOptions { |
@@ -292,6 +294,7 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
const syncer::SyncCredentials& credentials, |
ChromeSyncNotificationBridge* chrome_sync_notification_bridge, |
syncer::SyncNotifierFactory* sync_notifier_factory, |
+ syncer::SyncManagerFactory* sync_manager_factory, |
bool delete_sync_data_folder, |
const std::string& restored_key_for_bootstrapping, |
syncer::SyncManager::TestingMode testing_mode, |
@@ -312,6 +315,7 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
syncer::SyncCredentials credentials; |
ChromeSyncNotificationBridge* const chrome_sync_notification_bridge; |
syncer::SyncNotifierFactory* const sync_notifier_factory; |
+ syncer::SyncManagerFactory* const sync_manager_factory; |
std::string lsid; |
bool delete_sync_data_folder; |
std::string restored_key_for_bootstrapping; |
@@ -321,6 +325,14 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
report_unrecoverable_error_function; |
}; |
+ // Allow derived classes to start the sync thread early. |
+ // Returns true on success, false otherwise. If the thread was already |
+ // running, does nothing and returns true. |
+ bool StartSyncThread(); |
+ |
+ // Getter for derived classes. May be NULL if the thread is not running. |
+ MessageLoop* sync_loop() const { return sync_thread_.message_loop(); } |
+ |
// Allows tests to perform alternate core initialization work. |
virtual void InitCore(const DoInitializeOptions& options); |
@@ -338,6 +350,8 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
const syncer::ModelTypeSet types_to_configure, |
const syncer::ModelTypeSet configured_types, |
const base::Callback<void(syncer::ModelTypeSet)>& ready_task); |
+ |
+ private: |
Nicolas Zea
2012/07/09 18:40:45
FYI this fell out in my rebase.
|
// The real guts of SyncBackendHost, to keep the public client API clean. |
class Core; |
@@ -349,6 +363,8 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
// has been created. |
NOT_INITIALIZED, // Initialization hasn't completed, but we've |
// constructed a SyncManager. |
+ CLEANING_NIGORI, // A partially downloaded nigori was found. We |
+ // perform a configuration cycle to blow it away. |
DOWNLOADING_NIGORI, // The SyncManager is initialized, but |
// we're fetching encryption information. |
REFRESHING_NIGORI, // The SyncManager is initialized, and we |
@@ -358,6 +374,13 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
INITIALIZED, // Initialization is complete. |
}; |
+ // InitializationComplete passes through the SyncBackendHost to forward |
+ // on to |frontend_|, and so that tests can intercept here if they need to |
+ // set up initial conditions. |
+ void HandleInitializationCompletedOnFrontendLoop( |
+ const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
+ bool success); |
+ |
// Checks if we have received a notice to turn on experimental datatypes |
// (via the nigori node) and informs the frontend if that is the case. |
// Note: it is illegal to call this before the backend is initialized. |
@@ -366,13 +389,6 @@ class SyncBackendHost : public BackendDataTypeConfigurer { |
// Downloading of nigori failed and will be retried. |
void OnNigoriDownloadRetry(); |
- // InitializationComplete passes through the SyncBackendHost to forward |
- // on to |frontend_|, and so that tests can intercept here if they need to |
- // set up initial conditions. |
- void HandleInitializationCompletedOnFrontendLoop( |
- const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
- bool success); |
- |
// Called from Core::OnSyncCycleCompleted to handle updating frontend |
// thread components. |
void HandleSyncCycleCompletedOnFrontendLoop( |