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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_pref_store.cc

Issue 924033002: Supervised Users: Replace kForceSafeSearch pref with kForceGoogleSearch and kForceYouTubeSafetyMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: review Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/supervised_user/supervised_user_pref_store_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" 5 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 22 matching lines...) Expand all
33 }, 33 },
34 { 34 {
35 supervised_users::kContentPackManualBehaviorHosts, 35 supervised_users::kContentPackManualBehaviorHosts,
36 prefs::kSupervisedUserManualHosts, 36 prefs::kSupervisedUserManualHosts,
37 }, 37 },
38 { 38 {
39 supervised_users::kContentPackManualBehaviorURLs, 39 supervised_users::kContentPackManualBehaviorURLs,
40 prefs::kSupervisedUserManualURLs, 40 prefs::kSupervisedUserManualURLs,
41 }, 41 },
42 { 42 {
43 supervised_users::kForceSafeSearch, prefs::kForceSafeSearch, 43 supervised_users::kForceSafeSearch, prefs::kForceGoogleSafeSearch,
44 },
45 {
46 supervised_users::kForceSafeSearch, prefs::kForceYouTubeSafetyMode,
44 }, 47 },
45 { 48 {
46 supervised_users::kRecordHistory, prefs::kRecordHistory, 49 supervised_users::kRecordHistory, prefs::kRecordHistory,
47 }, 50 },
48 { 51 {
49 supervised_users::kSigninAllowed, prefs::kSigninAllowed, 52 supervised_users::kSigninAllowed, prefs::kSigninAllowed,
50 }, 53 },
51 { 54 {
52 supervised_users::kUserName, prefs::kProfileName, 55 supervised_users::kUserName, prefs::kProfileName,
53 }, 56 },
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 96
94 void SupervisedUserPrefStore::OnNewSettingsAvailable( 97 void SupervisedUserPrefStore::OnNewSettingsAvailable(
95 const base::DictionaryValue* settings) { 98 const base::DictionaryValue* settings) {
96 scoped_ptr<PrefValueMap> old_prefs = prefs_.Pass(); 99 scoped_ptr<PrefValueMap> old_prefs = prefs_.Pass();
97 prefs_.reset(new PrefValueMap); 100 prefs_.reset(new PrefValueMap);
98 if (settings) { 101 if (settings) {
99 // Set hardcoded prefs and defaults. 102 // Set hardcoded prefs and defaults.
100 prefs_->SetBoolean(prefs::kAllowDeletingBrowserHistory, false); 103 prefs_->SetBoolean(prefs::kAllowDeletingBrowserHistory, false);
101 prefs_->SetInteger(prefs::kDefaultSupervisedUserFilteringBehavior, 104 prefs_->SetInteger(prefs::kDefaultSupervisedUserFilteringBehavior,
102 SupervisedUserURLFilter::ALLOW); 105 SupervisedUserURLFilter::ALLOW);
103 prefs_->SetBoolean(prefs::kForceSafeSearch, true); 106 prefs_->SetBoolean(prefs::kForceGoogleSafeSearch, true);
107 prefs_->SetBoolean(prefs::kForceYouTubeSafetyMode, true);
104 prefs_->SetBoolean(prefs::kHideWebStoreIcon, true); 108 prefs_->SetBoolean(prefs::kHideWebStoreIcon, true);
105 prefs_->SetInteger(prefs::kIncognitoModeAvailability, 109 prefs_->SetInteger(prefs::kIncognitoModeAvailability,
106 IncognitoModePrefs::DISABLED); 110 IncognitoModePrefs::DISABLED);
107 prefs_->SetBoolean(prefs::kRecordHistory, true); 111 prefs_->SetBoolean(prefs::kRecordHistory, true);
108 prefs_->SetBoolean(prefs::kSigninAllowed, false); 112 prefs_->SetBoolean(prefs::kSigninAllowed, false);
109 113
110 // Copy supervised user settings to prefs. 114 // Copy supervised user settings to prefs.
111 for (const auto& entry : kSupervisedUserSettingsPrefMapping) { 115 for (const auto& entry : kSupervisedUserSettingsPrefMapping) {
112 const base::Value* value = NULL; 116 const base::Value* value = NULL;
113 if (settings->GetWithoutPathExpansion(entry.settings_name, &value)) 117 if (settings->GetWithoutPathExpansion(entry.settings_name, &value))
(...skipping 26 matching lines...) Expand all
140 } 144 }
141 145
142 std::vector<std::string> changed_prefs; 146 std::vector<std::string> changed_prefs;
143 prefs_->GetDifferingKeys(old_prefs.get(), &changed_prefs); 147 prefs_->GetDifferingKeys(old_prefs.get(), &changed_prefs);
144 148
145 // Send out change notifications. 149 // Send out change notifications.
146 for (const std::string& pref : changed_prefs) { 150 for (const std::string& pref : changed_prefs) {
147 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(pref)); 151 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(pref));
148 } 152 }
149 } 153 }
OLDNEW
« no previous file with comments | « no previous file | 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