Chromium Code Reviews| Index: chrome/browser/supervised_user/supervised_user_service.cc |
| diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc |
| index 07deebfba15aee56a31d1c919ecfbb712686accc..b3fb56c28d2db03dcd010c482aa829ad14bf29a5 100644 |
| --- a/chrome/browser/supervised_user/supervised_user_service.cc |
| +++ b/chrome/browser/supervised_user/supervised_user_service.cc |
| @@ -323,6 +323,15 @@ void SupervisedUserService::OnExtensionUnloaded( |
| } |
| #endif // defined(ENABLE_EXTENSIONS) |
| +syncer::ModelTypeSet SupervisedUserService::GetRequiredSyncDataTypes() { |
| + if (!ProfileIsSupervised()) |
|
Bernhard Bauer
2014/07/30 12:38:51
If we only add ourselves as a data type provider i
Marc Treib
2014/07/30 13:10:39
Alright, I'm registering/removing the provider in
|
| + return syncer::ModelTypeSet(); |
| + |
| + return syncer::ModelTypeSet(syncer::SESSIONS, |
| + syncer::APPS, |
| + syncer::EXTENSIONS); |
| +} |
| + |
| void SupervisedUserService::OnStateChanged() { |
| ProfileSyncService* service = |
| ProfileSyncServiceFactory::GetForProfile(profile_); |
| @@ -370,11 +379,9 @@ void SupervisedUserService::FinishSetupSync() { |
| ProfileSyncServiceFactory::GetForProfile(profile_); |
| DCHECK(service->sync_initialized()); |
| + // Sync nothing (except types which are set via GetRequiredSyncDataTypes). |
| bool sync_everything = false; |
| syncer::ModelTypeSet synced_datatypes; |
| - synced_datatypes.Put(syncer::SESSIONS); |
| - synced_datatypes.Put(syncer::APPS); |
| - synced_datatypes.Put(syncer::EXTENSIONS); |
| service->OnUserChoseDatatypes(sync_everything, synced_datatypes); |
| // Notify ProfileSyncService that we are done with configuration. |
| @@ -609,6 +616,9 @@ void SupervisedUserService::SetActive(bool active) { |
| SetExtensionsActive(); |
| #endif |
| + ProfileSyncService* sync_service = |
| + ProfileSyncServiceFactory::GetForProfile(profile_); |
| + |
| if (active_) { |
| if (CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kPermissionRequestApiUrl)) { |
| @@ -635,6 +645,8 @@ void SupervisedUserService::SetActive(bool active) { |
| base::Bind(&SupervisedUserService::UpdateManualURLs, |
| base::Unretained(this))); |
| + sync_service->AddDataTypeProvider(this); |
| + |
| // Initialize the filter. |
| OnDefaultFilteringBehaviorChanged(); |
| UpdateSiteLists(); |
| @@ -654,11 +666,9 @@ void SupervisedUserService::SetActive(bool active) { |
| pref_change_registrar_.Remove(prefs::kSupervisedUserManualHosts); |
| pref_change_registrar_.Remove(prefs::kSupervisedUserManualURLs); |
| - if (waiting_for_sync_initialization_) { |
| - ProfileSyncService* sync_service = |
| - ProfileSyncServiceFactory::GetForProfile(profile_); |
| + sync_service->RemoveDataTypeProvider(this); |
| + if (waiting_for_sync_initialization_) |
| sync_service->RemoveObserver(this); |
| - } |
| #if !defined(OS_ANDROID) |
| // TODO(bauerb): Get rid of the platform-specific #ifdef here. |