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

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

Issue 698253002: Supervised user SafeSites: Add a field trial to turn on/off (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 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_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"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/version.h" 12 #include "base/version.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h " 14 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h "
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_info_cache.h" 16 #include "chrome/browser/profiles/profile_info_cache.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
19 #include "chrome/browser/signin/signin_manager_factory.h" 19 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist_ downloader.h" 20 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist_ downloader.h"
21 #include "chrome/browser/supervised_user/experimental/supervised_user_filtering_ switches.h"
21 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice.h" 22 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice.h"
22 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice_factory.h" 23 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice_factory.h"
23 #include "chrome/browser/supervised_user/legacy/permission_request_creator_sync. h" 24 #include "chrome/browser/supervised_user/legacy/permission_request_creator_sync. h"
24 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser vice.h" 25 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser vice.h"
25 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser vice_factory.h" 26 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser vice_factory.h"
26 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti lity.h" 27 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti lity.h"
27 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service_factory.h" 28 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service_factory.h"
28 #include "chrome/browser/supervised_user/supervised_user_constants.h" 29 #include "chrome/browser/supervised_user/supervised_user_constants.h"
29 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" 30 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
30 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" 31 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 pref_change_registrar_.Add(pref, 791 pref_change_registrar_.Add(pref,
791 base::Bind(&SupervisedUserService::OnCustodianInfoChanged, 792 base::Bind(&SupervisedUserService::OnCustodianInfoChanged,
792 base::Unretained(this))); 793 base::Unretained(this)));
793 } 794 }
794 795
795 // Initialize the filter. 796 // Initialize the filter.
796 OnDefaultFilteringBehaviorChanged(); 797 OnDefaultFilteringBehaviorChanged();
797 whitelist_service_->Init(); 798 whitelist_service_->Init();
798 UpdateManualHosts(); 799 UpdateManualHosts();
799 UpdateManualURLs(); 800 UpdateManualURLs();
800 bool use_blacklist = base::CommandLine::ForCurrentProcess()->HasSwitch( 801 if (profile_->IsChild() &&
801 switches::kEnableSupervisedUserBlacklist); 802 supervised_users::IsSafeSitesBlacklistEnabled()) {
802 if (delegate_ && use_blacklist) {
803 base::FilePath blacklist_path = delegate_->GetBlacklistPath(); 803 base::FilePath blacklist_path = delegate_->GetBlacklistPath();
804 if (!blacklist_path.empty()) 804 if (!blacklist_path.empty())
805 LoadBlacklist(blacklist_path, delegate_->GetBlacklistURL()); 805 LoadBlacklist(blacklist_path, delegate_->GetBlacklistURL());
806 } 806 }
807 bool use_safesites = base::CommandLine::ForCurrentProcess()->HasSwitch( 807 if (profile_->IsChild() &&
808 switches::kEnableSupervisedUserSafeSites); 808 supervised_users::IsSafeSitesOnlineCheckEnabled()) {
809 if (delegate_ && use_safesites) {
810 const std::string& cx = delegate_->GetSafeSitesCx(); 809 const std::string& cx = delegate_->GetSafeSitesCx();
811 if (!cx.empty()) { 810 if (!cx.empty()) {
812 url_filter_context_.InitAsyncURLChecker( 811 url_filter_context_.InitAsyncURLChecker(
813 profile_->GetRequestContext(), cx); 812 profile_->GetRequestContext(), cx);
814 } 813 }
815 } 814 }
816 815
817 #if !defined(OS_ANDROID) 816 #if !defined(OS_ANDROID)
818 // TODO(bauerb): Get rid of the platform-specific #ifdef here. 817 // TODO(bauerb): Get rid of the platform-specific #ifdef here.
819 // http://crbug.com/313377 818 // http://crbug.com/313377
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 // The active user can be NULL in unit tests. 952 // The active user can be NULL in unit tests.
954 if (user_manager::UserManager::Get()->GetActiveUser()) { 953 if (user_manager::UserManager::Get()->GetActiveUser()) {
955 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( 954 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
956 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); 955 user_manager::UserManager::Get()->GetActiveUser()->GetUserID()));
957 } 956 }
958 return std::string(); 957 return std::string();
959 #else 958 #else
960 return profile_->GetPrefs()->GetString(prefs::kProfileName); 959 return profile_->GetPrefs()->GetString(prefs::kProfileName);
961 #endif 960 #endif
962 } 961 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/experimental/supervised_user_filtering_switches.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698