| 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/prefs/pref_value_map.h" | 10 #include "base/prefs/pref_value_map.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 12 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 13 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 13 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
| 14 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 14 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
| 15 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 15 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 | 17 |
| 18 using base::FundamentalValue; | 18 using base::FundamentalValue; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 struct SupervisedUserSettingsPrefMappingEntry { | 22 struct SupervisedUserSettingsPrefMappingEntry { |
| 23 const char* settings_name; | 23 const char* settings_name; |
| 24 const char* pref_name; | 24 const char* pref_name; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 SupervisedUserSettingsPrefMappingEntry kSupervisedUserSettingsPrefMapping[] = { | 27 SupervisedUserSettingsPrefMappingEntry kSupervisedUserSettingsPrefMapping[] = { |
| 28 { | 28 { |
| 29 supervised_users::kAllowDeletingBrowserHistory, |
| 30 prefs::kAllowDeletingBrowserHistory, |
| 31 }, |
| 32 { |
| 29 supervised_users::kContentPackDefaultFilteringBehavior, | 33 supervised_users::kContentPackDefaultFilteringBehavior, |
| 30 prefs::kDefaultSupervisedUserFilteringBehavior, | 34 prefs::kDefaultSupervisedUserFilteringBehavior, |
| 31 }, | 35 }, |
| 32 { | 36 { |
| 33 supervised_users::kContentPackManualBehaviorHosts, | 37 supervised_users::kContentPackManualBehaviorHosts, |
| 34 prefs::kSupervisedUserManualHosts, | 38 prefs::kSupervisedUserManualHosts, |
| 35 }, | 39 }, |
| 36 { | 40 { |
| 37 supervised_users::kContentPackManualBehaviorURLs, | 41 supervised_users::kContentPackManualBehaviorURLs, |
| 38 prefs::kSupervisedUserManualURLs, | 42 prefs::kSupervisedUserManualURLs, |
| 39 }, | 43 }, |
| 40 { | 44 { |
| 41 supervised_users::kForceSafeSearch, prefs::kForceSafeSearch, | 45 supervised_users::kForceSafeSearch, prefs::kForceSafeSearch, |
| 42 }, | 46 }, |
| 43 { | 47 { |
| 48 supervised_users::kIncognitoModeAvailability, |
| 49 prefs::kIncognitoModeAvailability, |
| 50 }, |
| 51 { |
| 44 supervised_users::kRecordHistory, prefs::kRecordHistory, | 52 supervised_users::kRecordHistory, prefs::kRecordHistory, |
| 45 }, | 53 }, |
| 46 { | 54 { |
| 47 supervised_users::kSigninAllowed, prefs::kSigninAllowed, | 55 supervised_users::kSigninAllowed, prefs::kSigninAllowed, |
| 48 }, | 56 }, |
| 49 { | 57 { |
| 50 supervised_users::kUserName, prefs::kProfileName, | 58 supervised_users::kUserName, prefs::kProfileName, |
| 51 }, | 59 }, |
| 52 }; | 60 }; |
| 53 | 61 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 127 } |
| 120 | 128 |
| 121 std::vector<std::string> changed_prefs; | 129 std::vector<std::string> changed_prefs; |
| 122 prefs_->GetDifferingKeys(old_prefs.get(), &changed_prefs); | 130 prefs_->GetDifferingKeys(old_prefs.get(), &changed_prefs); |
| 123 | 131 |
| 124 // Send out change notifications. | 132 // Send out change notifications. |
| 125 for (const std::string& pref : changed_prefs) { | 133 for (const std::string& pref : changed_prefs) { |
| 126 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(pref)); | 134 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(pref)); |
| 127 } | 135 } |
| 128 } | 136 } |
| OLD | NEW |