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

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

Issue 480513004: Stopping the history recording for a supervised user (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made documentation clearer. Created 6 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 unified diff | Download patch
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_value_map.h" 8 #include "base/prefs/pref_value_map.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/prefs/incognito_mode_prefs.h" 10 #include "chrome/browser/prefs/incognito_mode_prefs.h"
(...skipping 18 matching lines...) Expand all
29 }, 29 },
30 { 30 {
31 supervised_users::kContentPackManualBehaviorHosts, 31 supervised_users::kContentPackManualBehaviorHosts,
32 prefs::kSupervisedUserManualHosts, 32 prefs::kSupervisedUserManualHosts,
33 }, 33 },
34 { 34 {
35 supervised_users::kContentPackManualBehaviorURLs, 35 supervised_users::kContentPackManualBehaviorURLs,
36 prefs::kSupervisedUserManualURLs, 36 prefs::kSupervisedUserManualURLs,
37 }, 37 },
38 { 38 {
39 supervised_users::kForceSafeSearch, 39 supervised_users::kForceSafeSearch, prefs::kForceSafeSearch,
40 prefs::kForceSafeSearch,
41 }, 40 },
42 { 41 {
43 supervised_users::kSigninAllowed, 42 supervised_users::kRecordHistory, prefs::kRecordHistory,
44 prefs::kSigninAllowed,
45 }, 43 },
46 { 44 {
47 supervised_users::kUserName, 45 supervised_users::kSigninAllowed, prefs::kSigninAllowed,
48 prefs::kProfileName, 46 },
47 {
48 supervised_users::kUserName, prefs::kProfileName,
49 }, 49 },
50 }; 50 };
51 51
52 } // namespace 52 } // namespace
53 53
54 SupervisedUserPrefStore::SupervisedUserPrefStore( 54 SupervisedUserPrefStore::SupervisedUserPrefStore(
55 SupervisedUserSettingsService* supervised_user_settings_service) 55 SupervisedUserSettingsService* supervised_user_settings_service)
56 : weak_ptr_factory_(this) { 56 : weak_ptr_factory_(this) {
57 supervised_user_settings_service->Subscribe( 57 supervised_user_settings_service->Subscribe(
58 base::Bind(&SupervisedUserPrefStore::OnNewSettingsAvailable, 58 base::Bind(&SupervisedUserPrefStore::OnNewSettingsAvailable,
(...skipping 29 matching lines...) Expand all
88 const base::DictionaryValue* settings) { 88 const base::DictionaryValue* settings) {
89 scoped_ptr<PrefValueMap> old_prefs = prefs_.Pass(); 89 scoped_ptr<PrefValueMap> old_prefs = prefs_.Pass();
90 prefs_.reset(new PrefValueMap); 90 prefs_.reset(new PrefValueMap);
91 if (settings) { 91 if (settings) {
92 // Set hardcoded prefs. 92 // Set hardcoded prefs.
93 prefs_->SetValue(prefs::kAllowDeletingBrowserHistory, 93 prefs_->SetValue(prefs::kAllowDeletingBrowserHistory,
94 new FundamentalValue(false)); 94 new FundamentalValue(false));
95 prefs_->SetValue(prefs::kDefaultSupervisedUserFilteringBehavior, 95 prefs_->SetValue(prefs::kDefaultSupervisedUserFilteringBehavior,
96 new FundamentalValue(SupervisedUserURLFilter::ALLOW)); 96 new FundamentalValue(SupervisedUserURLFilter::ALLOW));
97 prefs_->SetValue(prefs::kForceSafeSearch, new FundamentalValue(true)); 97 prefs_->SetValue(prefs::kForceSafeSearch, new FundamentalValue(true));
98 prefs_->SetValue(prefs::kRecordHistory, new FundamentalValue(true));
98 prefs_->SetValue(prefs::kHideWebStoreIcon, new FundamentalValue(true)); 99 prefs_->SetValue(prefs::kHideWebStoreIcon, new FundamentalValue(true));
99 prefs_->SetValue(prefs::kIncognitoModeAvailability, 100 prefs_->SetValue(prefs::kIncognitoModeAvailability,
100 new FundamentalValue(IncognitoModePrefs::DISABLED)); 101 new FundamentalValue(IncognitoModePrefs::DISABLED));
101 prefs_->SetValue(prefs::kSigninAllowed, new FundamentalValue(false)); 102 prefs_->SetValue(prefs::kSigninAllowed, new FundamentalValue(false));
102 103
103 // Copy supervised user settings to prefs. 104 // Copy supervised user settings to prefs.
104 for (size_t i = 0; i < arraysize(kSupervisedUserSettingsPrefMapping); ++i) { 105 for (size_t i = 0; i < arraysize(kSupervisedUserSettingsPrefMapping); ++i) {
105 const SupervisedUserSettingsPrefMappingEntry& entry = 106 const SupervisedUserSettingsPrefMappingEntry& entry =
106 kSupervisedUserSettingsPrefMapping[i]; 107 kSupervisedUserSettingsPrefMapping[i];
107 const base::Value* value = NULL; 108 const base::Value* value = NULL;
(...skipping 10 matching lines...) Expand all
118 std::vector<std::string> changed_prefs; 119 std::vector<std::string> changed_prefs;
119 prefs_->GetDifferingKeys(old_prefs.get(), &changed_prefs); 120 prefs_->GetDifferingKeys(old_prefs.get(), &changed_prefs);
120 121
121 // Send out change notifications. 122 // Send out change notifications.
122 for (std::vector<std::string>::const_iterator pref(changed_prefs.begin()); 123 for (std::vector<std::string>::const_iterator pref(changed_prefs.begin());
123 pref != changed_prefs.end(); 124 pref != changed_prefs.end();
124 ++pref) { 125 ++pref) {
125 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(*pref)); 126 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(*pref));
126 } 127 }
127 } 128 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_constants.cc ('k') | chrome/browser/supervised_user/supervised_user_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698