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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 base::Unretained(this))); | 708 base::Unretained(this))); |
709 pref_change_registrar_.Add(prefs::kSupervisedUserManualURLs, | 709 pref_change_registrar_.Add(prefs::kSupervisedUserManualURLs, |
710 base::Bind(&SupervisedUserService::UpdateManualURLs, | 710 base::Bind(&SupervisedUserService::UpdateManualURLs, |
711 base::Unretained(this))); | 711 base::Unretained(this))); |
712 | 712 |
713 // Initialize the filter. | 713 // Initialize the filter. |
714 OnDefaultFilteringBehaviorChanged(); | 714 OnDefaultFilteringBehaviorChanged(); |
715 UpdateSiteLists(); | 715 UpdateSiteLists(); |
716 UpdateManualHosts(); | 716 UpdateManualHosts(); |
717 UpdateManualURLs(); | 717 UpdateManualURLs(); |
718 if (delegate_) { | 718 bool use_blacklist = |
| 719 CommandLine::ForCurrentProcess()->HasSwitch( |
| 720 switches::kEnableSupervisedUserBlacklist); |
| 721 if (delegate_ && use_blacklist) { |
719 base::FilePath blacklist_path = delegate_->GetBlacklistPath(); | 722 base::FilePath blacklist_path = delegate_->GetBlacklistPath(); |
720 if (!blacklist_path.empty()) | 723 if (!blacklist_path.empty()) |
721 LoadBlacklist(blacklist_path); | 724 LoadBlacklist(blacklist_path); |
722 } | 725 } |
723 | 726 |
724 #if !defined(OS_ANDROID) | 727 #if !defined(OS_ANDROID) |
725 // TODO(bauerb): Get rid of the platform-specific #ifdef here. | 728 // TODO(bauerb): Get rid of the platform-specific #ifdef here. |
726 // http://crbug.com/313377 | 729 // http://crbug.com/313377 |
727 BrowserList::AddObserver(this); | 730 BrowserList::AddObserver(this); |
728 #endif | 731 #endif |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 // The active user can be NULL in unit tests. | 850 // The active user can be NULL in unit tests. |
848 if (user_manager::UserManager::Get()->GetActiveUser()) { | 851 if (user_manager::UserManager::Get()->GetActiveUser()) { |
849 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( | 852 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( |
850 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); | 853 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); |
851 } | 854 } |
852 return std::string(); | 855 return std::string(); |
853 #else | 856 #else |
854 return profile_->GetPrefs()->GetString(prefs::kProfileName); | 857 return profile_->GetPrefs()->GetString(prefs::kProfileName); |
855 #endif | 858 #endif |
856 } | 859 } |
OLD | NEW |