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

Unified Diff: chrome/browser/policy/configuration_policy_handler_list_factory.cc

Issue 2401733002: Revert "Added a ForceYouTubeRestrict policy and deprecated the old ForceYouTubeSafetyMode policy" (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/net/safe_search_util_unittest.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/configuration_policy_handler_list_factory.cc
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
index b5c1210616fd30647e10aa711821f0ae80ff2cf4..3739445cce9664ca78d1ccc210b47035d92c54a8 100644
--- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc
+++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -16,7 +16,6 @@
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/net/disk_cache_dir_policy_handler.h"
-#include "chrome/browser/net/safe_search_util.h"
#include "chrome/browser/policy/file_selection_dialogs_policy_handler.h"
#include "chrome/browser/policy/javascript_policy_handler.h"
#include "chrome/browser/policy/managed_bookmarks_policy_handler.h"
@@ -120,9 +119,9 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
{ key::kForceGoogleSafeSearch,
prefs::kForceGoogleSafeSearch,
base::Value::TYPE_BOOLEAN },
- { key::kForceYouTubeRestrict,
- prefs::kForceYouTubeRestrict,
- base::Value::TYPE_INTEGER},
+ { key::kForceYouTubeSafetyMode,
+ prefs::kForceYouTubeSafetyMode,
+ base::Value::TYPE_BOOLEAN },
{ key::kPasswordManagerEnabled,
password_manager::prefs::kPasswordManagerSavingEnabled,
base::Value::TYPE_BOOLEAN },
@@ -619,30 +618,17 @@ class ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler {
// ConfigurationPolicyHandler implementation:
void ApplyPolicySettings(const PolicyMap& policies,
PrefValueMap* prefs) override {
- // If either of the new ForceGoogleSafeSearch, ForceYouTubeSafetyMode or
- // ForceYouTubeRestrict policies are defined, then this one should be
- // ignored. crbug.com/476908, crbug.com/590478
- // Note: Those policies are declared in kSimplePolicyMap above, except
- // ForceYouTubeSafetyMode, which has been replaced by ForceYouTubeRestrict.
+ // If either of the new GoogleSafeSearch or YouTubeSafetyMode policies is
+ // defined, then this one should be ignored. crbug.com/476908
+ // Note: Those policies are declared in kSimplePolicyMap above.
if (policies.GetValue(key::kForceGoogleSafeSearch) ||
- policies.GetValue(key::kForceYouTubeSafetyMode) ||
- policies.GetValue(key::kForceYouTubeRestrict)) {
+ policies.GetValue(key::kForceYouTubeSafetyMode)) {
return;
}
const base::Value* value = policies.GetValue(policy_name());
if (value) {
- bool enabled;
prefs->SetValue(prefs::kForceGoogleSafeSearch, value->CreateDeepCopy());
-
- // Note that ForceYouTubeRestrict is an int policy, we cannot simply deep
- // copy value, which is a boolean.
- if (value->GetAsBoolean(&enabled)) {
- prefs->SetValue(
- prefs::kForceYouTubeRestrict,
- base::MakeUnique<base::FundamentalValue>(
- enabled ? safe_search_util::YOUTUBE_RESTRICT_MODERATE
- : safe_search_util::YOUTUBE_RESTRICT_OFF));
- }
+ prefs->SetValue(prefs::kForceYouTubeSafetyMode, value->CreateDeepCopy());
}
}
@@ -650,36 +636,6 @@ class ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler {
DISALLOW_COPY_AND_ASSIGN(ForceSafeSearchPolicyHandler);
};
-class ForceYouTubeSafetyModePolicyHandler : public TypeCheckingPolicyHandler {
- public:
- ForceYouTubeSafetyModePolicyHandler()
- : TypeCheckingPolicyHandler(key::kForceYouTubeSafetyMode,
- base::Value::TYPE_BOOLEAN) {}
- ~ForceYouTubeSafetyModePolicyHandler() override {}
-
- // ConfigurationPolicyHandler implementation:
- void ApplyPolicySettings(const PolicyMap& policies,
- PrefValueMap* prefs) override {
- // If only the deprecated ForceYouTubeSafetyMode policy is set,
- // but not ForceYouTubeRestrict, set ForceYouTubeRestrict to Moderate.
- if (policies.GetValue(key::kForceYouTubeRestrict))
- return;
-
- const base::Value* value = policies.GetValue(policy_name());
- bool enabled;
- if (value && value->GetAsBoolean(&enabled)) {
- prefs->SetValue(
- prefs::kForceYouTubeRestrict,
- base::MakeUnique<base::FundamentalValue>(
- enabled ? safe_search_util::YOUTUBE_RESTRICT_MODERATE
- : safe_search_util::YOUTUBE_RESTRICT_OFF));
- }
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ForceYouTubeSafetyModePolicyHandler);
-};
-
#if defined(ENABLE_EXTENSIONS)
void GetExtensionAllowedTypesMap(
ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) {
@@ -730,7 +686,6 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildHandlerList(
handlers->AddHandler(base::MakeUnique<AutofillPolicyHandler>());
handlers->AddHandler(base::MakeUnique<DefaultSearchPolicyHandler>());
handlers->AddHandler(base::MakeUnique<ForceSafeSearchPolicyHandler>());
- handlers->AddHandler(base::MakeUnique<ForceYouTubeSafetyModePolicyHandler>());
handlers->AddHandler(base::MakeUnique<IncognitoModePolicyHandler>());
handlers->AddHandler(
base::MakeUnique<ManagedBookmarksPolicyHandler>(chrome_schema));
« no previous file with comments | « chrome/browser/net/safe_search_util_unittest.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698