| 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 7c3a31027dcc3b2320f49064a480e0b5c233d9ee..f8464a8fd2c3f4523f77dd9ccd01864202f7b4e8 100644
|
| --- a/chrome/browser/supervised_user/supervised_user_service.cc
|
| +++ b/chrome/browser/supervised_user/supervised_user_service.cc
|
| @@ -156,6 +156,9 @@ void SupervisedUserService::Shutdown() {
|
| content::RecordAction(UserMetricsAction("ManagedUsers_QuitBrowser"));
|
| }
|
| SetActive(false);
|
| +
|
| + ProfileSyncServiceFactory::GetForProfile(profile_)->RemovePreferenceProvider(
|
| + this);
|
| }
|
|
|
| bool SupervisedUserService::ProfileIsSupervised() const {
|
| @@ -323,6 +326,21 @@ void SupervisedUserService::OnExtensionUnloaded(
|
| }
|
| #endif // defined(ENABLE_EXTENSIONS)
|
|
|
| +syncer::ModelTypeSet SupervisedUserService::GetPreferredDataTypes() {
|
| + if (!ProfileIsSupervised())
|
| + return syncer::ModelTypeSet();
|
| +
|
| + syncer::ModelTypeSet result;
|
| + result.Put(syncer::SESSIONS);
|
| + result.Put(syncer::EXTENSIONS);
|
| + result.Put(syncer::EXTENSION_SETTINGS);
|
| + result.Put(syncer::APPS);
|
| + result.Put(syncer::APP_SETTINGS);
|
| + result.Put(syncer::APP_NOTIFICATIONS);
|
| + result.Put(syncer::APP_LIST);
|
| + return result;
|
| +}
|
| +
|
| void SupervisedUserService::OnStateChanged() {
|
| ProfileSyncService* service =
|
| ProfileSyncServiceFactory::GetForProfile(profile_);
|
| @@ -370,11 +388,9 @@ void SupervisedUserService::FinishSetupSync() {
|
| ProfileSyncServiceFactory::GetForProfile(profile_);
|
| DCHECK(service->sync_initialized());
|
|
|
| + // Sync nothing (except types which are set via GetPreferredDataTypes).
|
| 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.
|
| @@ -563,6 +579,9 @@ void SupervisedUserService::Init() {
|
| base::Bind(&SupervisedUserService::OnSupervisedUserIdChanged,
|
| base::Unretained(this)));
|
|
|
| + ProfileSyncServiceFactory::GetForProfile(profile_)->AddPreferenceProvider(
|
| + this);
|
| +
|
| SetActive(ProfileIsSupervised());
|
| }
|
|
|
| @@ -654,11 +673,8 @@ 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->RemoveObserver(this);
|
| - }
|
| + if (waiting_for_sync_initialization_)
|
| + ProfileSyncServiceFactory::GetForProfile(profile_)->RemoveObserver(this);
|
|
|
| #if !defined(OS_ANDROID)
|
| // TODO(bauerb): Get rid of the platform-specific #ifdef here.
|
|
|