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_service.h" | 5 #include "chrome/browser/supervised_user/supervised_user_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 | 283 |
284 void SupervisedUserService::OnCustodianInfoChanged() { | 284 void SupervisedUserService::OnCustodianInfoChanged() { |
285 FOR_EACH_OBSERVER( | 285 FOR_EACH_OBSERVER( |
286 SupervisedUserServiceObserver, observer_list_, OnCustodianInfoChanged()); | 286 SupervisedUserServiceObserver, observer_list_, OnCustodianInfoChanged()); |
287 } | 287 } |
288 | 288 |
289 // static | 289 // static |
290 void SupervisedUserService::RegisterProfilePrefs( | 290 void SupervisedUserService::RegisterProfilePrefs( |
291 user_prefs::PrefRegistrySyncable* registry) { | 291 user_prefs::PrefRegistrySyncable* registry) { |
292 registry->RegisterDictionaryPref( | 292 registry->RegisterDictionaryPref(prefs::kSupervisedUserManualHosts); |
293 prefs::kSupervisedUserManualHosts, | 293 registry->RegisterDictionaryPref(prefs::kSupervisedUserManualURLs); |
294 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 294 registry->RegisterIntegerPref(prefs::kDefaultSupervisedUserFilteringBehavior, |
295 registry->RegisterDictionaryPref( | 295 SupervisedUserURLFilter::ALLOW); |
296 prefs::kSupervisedUserManualURLs, | 296 registry->RegisterBooleanPref(prefs::kSupervisedUserCreationAllowed, true); |
297 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
298 registry->RegisterIntegerPref( | |
299 prefs::kDefaultSupervisedUserFilteringBehavior, | |
300 SupervisedUserURLFilter::ALLOW, | |
301 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
302 registry->RegisterBooleanPref(prefs::kSupervisedUserCreationAllowed, true, | |
303 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
304 for (const char* pref : kCustodianInfoPrefs) { | 297 for (const char* pref : kCustodianInfoPrefs) { |
305 registry->RegisterStringPref(pref, std::string(), | 298 registry->RegisterStringPref(pref, std::string()); |
306 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
307 } | 299 } |
308 } | 300 } |
309 | 301 |
310 void SupervisedUserService::SetDelegate(Delegate* delegate) { | 302 void SupervisedUserService::SetDelegate(Delegate* delegate) { |
311 if (delegate) { | 303 if (delegate) { |
312 // Changing delegates isn't allowed. | 304 // Changing delegates isn't allowed. |
313 DCHECK(!delegate_); | 305 DCHECK(!delegate_); |
314 } else { | 306 } else { |
315 // If the delegate is removed, deactivate first to give the old delegate a | 307 // If the delegate is removed, deactivate first to give the old delegate a |
316 // chance to clean up. | 308 // chance to clean up. |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 // The active user can be NULL in unit tests. | 952 // The active user can be NULL in unit tests. |
961 if (user_manager::UserManager::Get()->GetActiveUser()) { | 953 if (user_manager::UserManager::Get()->GetActiveUser()) { |
962 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( | 954 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( |
963 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); | 955 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); |
964 } | 956 } |
965 return std::string(); | 957 return std::string(); |
966 #else | 958 #else |
967 return profile_->GetPrefs()->GetString(prefs::kProfileName); | 959 return profile_->GetPrefs()->GetString(prefs::kProfileName); |
968 #endif | 960 #endif |
969 } | 961 } |
OLD | NEW |