Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 480513004: Stopping the history recording for a supervised user (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wrapped RecordHistory in a pref. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8b45a60a84a11951dcdffcfeebc45f1185df2bdc..a39fd6d44f43ee5795b8bc151fb9ed8ca5375b80 100644
--- a/chrome/browser/supervised_user/supervised_user_service.cc
+++ b/chrome/browser/supervised_user/supervised_user_service.cc
@@ -132,7 +132,8 @@ void SupervisedUserService::URLFilterContext::SetManualURLs(
}
SupervisedUserService::SupervisedUserService(Profile* profile)
- : profile_(profile),
+ : includes_sync_sessions_(true),
+ profile_(profile),
active_(false),
delegate_(NULL),
#if defined(ENABLE_EXTENSIONS)
@@ -359,7 +360,8 @@ syncer::ModelTypeSet SupervisedUserService::GetPreferredDataTypes() const {
return syncer::ModelTypeSet();
syncer::ModelTypeSet result;
- result.Put(syncer::SESSIONS);
+ if (IncludesSyncSessions())
+ result.Put(syncer::SESSIONS);
result.Put(syncer::EXTENSIONS);
result.Put(syncer::EXTENSION_SETTINGS);
result.Put(syncer::APPS);
@@ -369,6 +371,26 @@ syncer::ModelTypeSet SupervisedUserService::GetPreferredDataTypes() const {
return result;
}
+void SupervisedUserService::OnHistoryRecordingStateChanged() {
+ bool has_session_sync_state_changed = FetchNewSessionSyncState();
+ if (has_session_sync_state_changed)
+ ProfileSyncServiceFactory::GetForProfile(profile_)
+ ->ReconfigureDatatypeManager();
+}
+
+bool SupervisedUserService::FetchNewSessionSyncState() {
Marc Treib 2014/08/20 14:14:26 This method doesn't seem necessary anymore, since
fhorschig 2014/08/20 14:48:03 Done.
+ bool old_includes_session_sync = includes_sync_sessions_;
+
+ includes_sync_sessions_ =
+ profile_->GetPrefs()->GetBoolean(prefs::kRecordHistory);
+
+ return old_includes_session_sync != includes_sync_sessions_;
+}
+
+bool SupervisedUserService::IncludesSyncSessions() const {
+ return includes_sync_sessions_;
+}
+
void SupervisedUserService::OnStateChanged() {
ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile_);
@@ -608,6 +630,10 @@ void SupervisedUserService::Init() {
prefs::kSupervisedUserId,
base::Bind(&SupervisedUserService::OnSupervisedUserIdChanged,
base::Unretained(this)));
+ pref_change_registrar_.Add(
+ prefs::kRecordHistory,
+ base::Bind(&SupervisedUserService::OnHistoryRecordingStateChanged,
+ base::Unretained(this)));
ProfileSyncService* sync_service =
ProfileSyncServiceFactory::GetForProfile(profile_);

Powered by Google App Engine
This is Rietveld 408576698