OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |