| 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 600e51683daa8217f7d1c3619ac252f51547c74e..00aa77e600572e3de1e2c4d4806fa09f6dadaec5 100644
|
| --- a/chrome/browser/sync/glue/sync_backend_host.h
|
| +++ b/chrome/browser/sync/glue/sync_backend_host.h
|
| @@ -226,15 +226,11 @@ class SyncBackendHost : public BackendDataTypeConfigurer {
|
| // is non-empty, then an error was encountered).
|
| virtual void ConfigureDataTypes(
|
| sync_api::ConfigureReason reason,
|
| - syncable::ModelTypeSet types_to_add,
|
| - syncable::ModelTypeSet types_to_remove,
|
| + const syncable::ModelTypeSet& desired_types,
|
| + const syncable::ModelTypeSet& disabled_types,
|
| NigoriState nigori_state,
|
| - base::Callback<void(syncable::ModelTypeSet)> ready_task,
|
| - base::Callback<void()> retry_callback) OVERRIDE;
|
| -
|
| - // Makes an asynchronous call to syncer to switch to config mode. When done
|
| - // syncer will call us back on FinishConfigureDataTypes.
|
| - virtual void StartConfiguration(const base::Closure& callback);
|
| + const base::Callback<void(syncable::ModelTypeSet)>& ready_task,
|
| + const base::Callback<void()>& retry_callback) OVERRIDE;
|
|
|
| // Turns on encryption of all present and future sync data.
|
| virtual void EnableEncryptEverything();
|
| @@ -333,16 +329,20 @@ class SyncBackendHost : public BackendDataTypeConfigurer {
|
| // Allows tests to perform alternate core initialization work.
|
| virtual void InitCore(const DoInitializeOptions& options);
|
|
|
| - // Called from Core::OnSyncCycleCompleted to handle updating frontend
|
| - // thread components.
|
| - void HandleSyncCycleCompletedOnFrontendLoop(
|
| - const sessions::SyncSessionSnapshot& snapshot);
|
| -
|
| - // Called to finish the job of ConfigureDataTypes once the syncer is in
|
| - // configuration mode.
|
| - void FinishConfigureDataTypesOnFrontendLoop();
|
| + // Request the syncer to reconfigure with the specfied params.
|
| + // Virtual for testing.
|
| + virtual void RequestConfigureSyncer(
|
| + sync_api::ConfigureReason reason,
|
| + syncable::ModelTypeSet types_to_config,
|
| + const browser_sync::ModelSafeRoutingInfo& routing_info,
|
| + const base::Callback<void(syncable::ModelTypeSet)>& ready_task,
|
| + const base::Closure& retry_callback);
|
|
|
| - bool IsDownloadingNigoriForTest() const;
|
| + // Called when the syncer has finished performing a configuration.
|
| + void FinishConfigureDataTypesOnFrontendLoop(
|
| + const syncable::ModelTypeSet& types_to_configure,
|
| + const syncable::ModelTypeSet& configured_types,
|
| + const base::Callback<void(syncable::ModelTypeSet)>& ready_task);
|
|
|
| private:
|
| // The real guts of SyncBackendHost, to keep the public client API clean.
|
| @@ -365,47 +365,32 @@ class SyncBackendHost : public BackendDataTypeConfigurer {
|
| INITIALIZED, // Initialization is complete.
|
| };
|
|
|
| - struct PendingConfigureDataTypesState {
|
| - PendingConfigureDataTypesState();
|
| - ~PendingConfigureDataTypesState();
|
| -
|
| - // The ready_task will be run when configuration is done with the
|
| - // set of all types that failed configuration (i.e., if its
|
| - // argument is non-empty, then an error was encountered).
|
| - base::Callback<void(syncable::ModelTypeSet)> ready_task;
|
| -
|
| - // The retry callback will be run when the download failed due to a
|
| - // transient error. This is to notify DTM so it can apropriately inform
|
| - // the UI. Note: The retry_callback will be run only once and after
|
| - // that we will not notify DTM until the sync is successful or in a
|
| - // permanent error state.
|
| - base::Callback<void()> retry_callback;
|
| -
|
| - // The set of types that we are waiting to be initially synced in a
|
| - // configuration cycle.
|
| - syncable::ModelTypeSet types_to_add;
|
| -
|
| - // Additional details about which types were added.
|
| - syncable::ModelTypeSet added_types;
|
| - sync_api::ConfigureReason reason;
|
| - bool retry_in_progress;
|
| - };
|
| -
|
| // 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.
|
| void AddExperimentalTypes();
|
|
|
| // Downloading of nigori failed and will be retried.
|
| - virtual void OnNigoriDownloadRetry();
|
| + 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.
|
| - virtual void HandleInitializationCompletedOnFrontendLoop(
|
| + void HandleInitializationCompletedOnFrontendLoop(
|
| const WeakHandle<JsBackend>& js_backend,
|
| bool success);
|
|
|
| + // Called from Core::OnSyncCycleCompleted to handle updating frontend
|
| + // thread components.
|
| + void HandleSyncCycleCompletedOnFrontendLoop(
|
| + const sessions::SyncSessionSnapshot& snapshot);
|
| +
|
| + // Called when the syncer failed to perform a configuration and will
|
| + // eventually retry. FinishingConfigurationOnFrontendLoop(..) will be called
|
| + // on successful completion.
|
| + void RetryConfigurationOnFrontendLoop(
|
| + const base::Closure& retry_callback);
|
| +
|
| // Helpers to persist a token that can be used to bootstrap sync encryption
|
| // across browser restart to avoid requiring the user to re-enter their
|
| // passphrase. |token| must be valid UTF-8 as we use the PrefService for
|
| @@ -509,9 +494,6 @@ class SyncBackendHost : public BackendDataTypeConfigurer {
|
| // The frontend which we serve (and are owned by).
|
| SyncFrontend* frontend_;
|
|
|
| - scoped_ptr<PendingConfigureDataTypesState> pending_download_state_;
|
| - scoped_ptr<PendingConfigureDataTypesState> pending_config_mode_state_;
|
| -
|
| // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired
|
| // is called. This way, before the UI calls SetDecryptionPassphrase on the
|
| // syncer, it can avoid the overhead of an asynchronous decryption call and
|
|
|