Commit 617a8563 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Remove SyncService::OnUserChoseDatatypes

It has been replaced by SyncUserSettings::SetChosenDataTypes.
Note that *Profile*SyncService::OnUserChoseDatatypes still exists for
now (it's used by SyncUserSettings). This will be changed in a later CL.

This required a minor change in unified_consent_service_unittest.cc:
This test's implementation of TestSyncService used to override
OnUserChoseDatatypes. This logic is now moved (in slightly generalized
form) into TestSyncUserSettings.

Bug: 884159
Change-Id: I6723543f78a3f8c42f9bc29a9da84376ad92126b
Reviewed-on: https://chromium-review.googlesource.com/c/1353878Reviewed-by: default avatarThomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611721}
parent 40d67e07
...@@ -236,8 +236,9 @@ class ProfileSyncService : public syncer::SyncService, ...@@ -236,8 +236,9 @@ class ProfileSyncService : public syncer::SyncService,
void RemoveObserver(syncer::SyncServiceObserver* observer) override; void RemoveObserver(syncer::SyncServiceObserver* observer) override;
bool HasObserver(const syncer::SyncServiceObserver* observer) const override; bool HasObserver(const syncer::SyncServiceObserver* observer) const override;
syncer::ModelTypeSet GetPreferredDataTypes() const override; syncer::ModelTypeSet GetPreferredDataTypes() const override;
void OnUserChoseDatatypes(bool sync_everything, // Virtual for testing.
syncer::ModelTypeSet chosen_types) override; virtual void OnUserChoseDatatypes(bool sync_everything,
syncer::ModelTypeSet chosen_types);
virtual void SetFirstSetupComplete(); // Virtual for testing. virtual void SetFirstSetupComplete(); // Virtual for testing.
std::unique_ptr<syncer::SyncSetupInProgressHandle> GetSetupInProgressHandle() std::unique_ptr<syncer::SyncSetupInProgressHandle> GetSetupInProgressHandle()
override; override;
......
...@@ -73,9 +73,6 @@ ModelTypeSet FakeSyncService::GetPreferredDataTypes() const { ...@@ -73,9 +73,6 @@ ModelTypeSet FakeSyncService::GetPreferredDataTypes() const {
return ModelTypeSet(); return ModelTypeSet();
} }
void FakeSyncService::OnUserChoseDatatypes(bool sync_everything,
ModelTypeSet chosen_types) {}
std::unique_ptr<SyncSetupInProgressHandle> std::unique_ptr<SyncSetupInProgressHandle>
FakeSyncService::GetSetupInProgressHandle() { FakeSyncService::GetSetupInProgressHandle() {
return nullptr; return nullptr;
......
...@@ -40,8 +40,6 @@ class FakeSyncService : public SyncService { ...@@ -40,8 +40,6 @@ class FakeSyncService : public SyncService {
void OnDataTypeRequestsSyncStartup(ModelType type) override; void OnDataTypeRequestsSyncStartup(ModelType type) override;
void RequestStop(SyncService::SyncStopDataFate data_fate) override; void RequestStop(SyncService::SyncStopDataFate data_fate) override;
ModelTypeSet GetPreferredDataTypes() const override; ModelTypeSet GetPreferredDataTypes() const override;
void OnUserChoseDatatypes(bool sync_everything,
ModelTypeSet chosen_types) override;
std::unique_ptr<SyncSetupInProgressHandle> GetSetupInProgressHandle() std::unique_ptr<SyncSetupInProgressHandle> GetSetupInProgressHandle()
override; override;
bool IsSetupInProgress() const override; bool IsSetupInProgress() const override;
......
...@@ -275,14 +275,6 @@ class SyncService : public DataTypeEncryptionHandler, public KeyedService { ...@@ -275,14 +275,6 @@ class SyncService : public DataTypeEncryptionHandler, public KeyedService {
// told to MergeDataAndStartSyncing yet. // told to MergeDataAndStartSyncing yet.
virtual void OnDataTypeRequestsSyncStartup(ModelType type) = 0; virtual void OnDataTypeRequestsSyncStartup(ModelType type) = 0;
// Called when a user chooses which data types to sync. |sync_everything|
// represents whether they chose the "keep everything synced" option; if
// true, |chosen_types| will be ignored and all data types will be synced.
// |sync_everything| means "sync all current and future data types."
// |chosen_types| must be a subset of UserSelectableTypes().
virtual void OnUserChoseDatatypes(bool sync_everything,
ModelTypeSet chosen_types) = 0;
// Triggers a GetUpdates call for the specified |types|, pulling any new data // Triggers a GetUpdates call for the specified |types|, pulling any new data
// from the sync server. Used by tests and debug UI (sync-internals). // from the sync server. Used by tests and debug UI (sync-internals).
virtual void TriggerRefresh(const ModelTypeSet& types) = 0; virtual void TriggerRefresh(const ModelTypeSet& types) = 0;
......
...@@ -152,9 +152,6 @@ void TestSyncService::RequestStop(SyncService::SyncStopDataFate data_fate) {} ...@@ -152,9 +152,6 @@ void TestSyncService::RequestStop(SyncService::SyncStopDataFate data_fate) {}
void TestSyncService::OnDataTypeRequestsSyncStartup(ModelType type) {} void TestSyncService::OnDataTypeRequestsSyncStartup(ModelType type) {}
void TestSyncService::OnUserChoseDatatypes(bool sync_everything,
ModelTypeSet chosen_types) {}
void TestSyncService::TriggerRefresh(const ModelTypeSet& types) {} void TestSyncService::TriggerRefresh(const ModelTypeSet& types) {}
void TestSyncService::ReenableDatatype(ModelType type) {} void TestSyncService::ReenableDatatype(ModelType type) {}
......
...@@ -62,8 +62,6 @@ class TestSyncService : public SyncService { ...@@ -62,8 +62,6 @@ class TestSyncService : public SyncService {
void RequestStop(SyncStopDataFate data_fate) override; void RequestStop(SyncStopDataFate data_fate) override;
void OnDataTypeRequestsSyncStartup(ModelType type) override; void OnDataTypeRequestsSyncStartup(ModelType type) override;
void OnUserChoseDatatypes(bool sync_everything,
ModelTypeSet chosen_types) override;
void TriggerRefresh(const ModelTypeSet& types) override; void TriggerRefresh(const ModelTypeSet& types) override;
void ReenableDatatype(ModelType type) override; void ReenableDatatype(ModelType type) override;
void ReadyForStartChanged(syncer::ModelType type) override; void ReadyForStartChanged(syncer::ModelType type) override;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "components/sync/driver/test_sync_user_settings.h" #include "components/sync/driver/test_sync_user_settings.h"
#include "components/sync/base/passphrase_enums.h" #include "components/sync/base/passphrase_enums.h"
#include "components/sync/base/sync_prefs.h"
#include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service.h"
#include "components/sync/driver/test_sync_service.h" #include "components/sync/driver/test_sync_service.h"
...@@ -65,7 +66,14 @@ ModelTypeSet TestSyncUserSettings::GetChosenDataTypes() const { ...@@ -65,7 +66,14 @@ ModelTypeSet TestSyncUserSettings::GetChosenDataTypes() const {
void TestSyncUserSettings::SetChosenDataTypes(bool sync_everything, void TestSyncUserSettings::SetChosenDataTypes(bool sync_everything,
ModelTypeSet types) { ModelTypeSet types) {
sync_everything_enabled_ = sync_everything; sync_everything_enabled_ = sync_everything;
service_->OnUserChoseDatatypes(sync_everything, types); syncer::ModelTypeSet preferred_types;
if (sync_everything_enabled_) {
preferred_types = syncer::ModelTypeSet::All();
} else {
preferred_types = syncer::SyncPrefs::ResolvePrefGroups(
/*registered_types=*/syncer::ModelTypeSet::All(), types);
}
service_->SetPreferredDataTypes(preferred_types);
} }
bool TestSyncUserSettings::IsEncryptEverythingAllowed() const { bool TestSyncUserSettings::IsEncryptEverythingAllowed() const {
......
...@@ -32,10 +32,6 @@ class TestSyncService : public syncer::TestSyncService { ...@@ -32,10 +32,6 @@ class TestSyncService : public syncer::TestSyncService {
void AddObserver(syncer::SyncServiceObserver* observer) override { void AddObserver(syncer::SyncServiceObserver* observer) override {
observer_ = observer; observer_ = observer;
} }
void OnUserChoseDatatypes(bool sync_everything,
syncer::ModelTypeSet chosen_types) override {
SetPreferredDataTypes(chosen_types);
}
void FireStateChanged() { void FireStateChanged() {
if (observer_) if (observer_)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment