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

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

Issue 2401743003: Recommit and fix of "Added a ForceYouTubeRestrict policy and deprecated the old ForceYouTubeSafetyM… (Closed)
Patch Set: Rebase Created 4 years, 2 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_pref_store.cc
diff --git a/chrome/browser/supervised_user/supervised_user_pref_store.cc b/chrome/browser/supervised_user/supervised_user_pref_store.cc
index 3f144a4709e338e9a58cceb3d1a11a2dca0ebdb2..e0d9d944130ac1846429a9b21f45c513c46140fc 100644
--- a/chrome/browser/supervised_user/supervised_user_pref_store.cc
+++ b/chrome/browser/supervised_user/supervised_user_pref_store.cc
@@ -11,6 +11,7 @@
#include "base/command_line.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/net/safe_search_util.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/supervised_user/supervised_user_bookmarks_handler.h"
#include "chrome/browser/supervised_user/supervised_user_constants.h"
@@ -51,9 +52,6 @@ SupervisedUserSettingsPrefMappingEntry kSupervisedUserSettingsPrefMapping[] = {
supervised_users::kForceSafeSearch, prefs::kForceGoogleSafeSearch,
},
{
- supervised_users::kForceSafeSearch, prefs::kForceYouTubeSafetyMode,
- },
- {
supervised_users::kSafeSitesEnabled, prefs::kSupervisedUserSafeSites,
},
{
@@ -116,7 +114,8 @@ void SupervisedUserPrefStore::OnNewSettingsAvailable(
prefs_->SetInteger(prefs::kDefaultSupervisedUserFilteringBehavior,
SupervisedUserURLFilter::ALLOW);
prefs_->SetBoolean(prefs::kForceGoogleSafeSearch, true);
- prefs_->SetBoolean(prefs::kForceYouTubeSafetyMode, true);
+ prefs_->SetInteger(prefs::kForceYouTubeRestrict,
+ safe_search_util::YOUTUBE_RESTRICT_MODERATE);
prefs_->SetBoolean(prefs::kHideWebStoreIcon, true);
prefs_->SetBoolean(prefs::kSigninAllowed, false);
@@ -128,19 +127,34 @@ void SupervisedUserPrefStore::OnNewSettingsAvailable(
}
// Manually set preferences that aren't direct copies of the settings value.
+ {
+ bool record_history = true;
+ settings->GetBoolean(supervised_users::kRecordHistory, &record_history);
+ prefs_->SetBoolean(prefs::kAllowDeletingBrowserHistory, !record_history);
+ prefs_->SetInteger(prefs::kIncognitoModeAvailability,
+ record_history ? IncognitoModePrefs::DISABLED
+ : IncognitoModePrefs::ENABLED);
+
+ bool record_history_includes_session_sync = true;
+ settings->GetBoolean(supervised_users::kRecordHistoryIncludesSessionSync,
+ &record_history_includes_session_sync);
+ prefs_->SetBoolean(
+ prefs::kForceSessionSync,
+ record_history && record_history_includes_session_sync);
+ }
- bool record_history = true;
- settings->GetBoolean(supervised_users::kRecordHistory, &record_history);
- prefs_->SetBoolean(prefs::kAllowDeletingBrowserHistory, !record_history);
- prefs_->SetInteger(prefs::kIncognitoModeAvailability,
- record_history ? IncognitoModePrefs::DISABLED
- : IncognitoModePrefs::ENABLED);
-
- bool record_history_includes_session_sync = true;
- settings->GetBoolean(supervised_users::kRecordHistoryIncludesSessionSync,
- &record_history_includes_session_sync);
- prefs_->SetBoolean(prefs::kForceSessionSync,
- record_history && record_history_includes_session_sync);
+ {
+ // Note that |prefs::kForceGoogleSafeSearch| is set automatically as part
+ // of |kSupervisedUserSettingsPrefMapping|, but this can't be done for
+ // |prefs::kForceYouTubeRestrict| because it is an int, not a bool.
+ bool force_safe_search = true;
+ settings->GetBoolean(supervised_users::kForceSafeSearch,
+ &force_safe_search);
+ prefs_->SetInteger(
+ prefs::kForceYouTubeRestrict,
+ force_safe_search ? safe_search_util::YOUTUBE_RESTRICT_MODERATE
+ : safe_search_util::YOUTUBE_RESTRICT_OFF);
+ }
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableSupervisedUserManagedBookmarksFolder)) {
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/supervised_user/supervised_user_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698