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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/metrics/user_metrics.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/task_runner_util.h" | 18 #include "base/task_runner_util.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
19 #include "base/version.h" | 20 #include "base/version.h" |
20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
21 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" | 23 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
(...skipping 20 matching lines...) Expand all Loading... |
44 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
45 #include "chrome/grit/generated_resources.h" | 46 #include "chrome/grit/generated_resources.h" |
46 #include "components/browser_sync/profile_sync_service.h" | 47 #include "components/browser_sync/profile_sync_service.h" |
47 #include "components/pref_registry/pref_registry_syncable.h" | 48 #include "components/pref_registry/pref_registry_syncable.h" |
48 #include "components/prefs/pref_service.h" | 49 #include "components/prefs/pref_service.h" |
49 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 50 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
50 #include "components/signin/core/browser/signin_manager.h" | 51 #include "components/signin/core/browser/signin_manager.h" |
51 #include "components/signin/core/browser/signin_manager_base.h" | 52 #include "components/signin/core/browser/signin_manager_base.h" |
52 #include "components/signin/core/common/signin_switches.h" | 53 #include "components/signin/core/common/signin_switches.h" |
53 #include "content/public/browser/browser_thread.h" | 54 #include "content/public/browser/browser_thread.h" |
54 #include "content/public/browser/user_metrics.h" | |
55 #include "extensions/features/features.h" | 55 #include "extensions/features/features.h" |
56 #include "net/traffic_annotation/network_traffic_annotation.h" | 56 #include "net/traffic_annotation/network_traffic_annotation.h" |
57 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
58 | 58 |
59 #if !defined(OS_ANDROID) | 59 #if !defined(OS_ANDROID) |
60 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser
vice.h" | 60 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser
vice.h" |
61 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser
vice_factory.h" | 61 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser
vice_factory.h" |
62 #include "chrome/browser/supervised_user/legacy/permission_request_creator_sync.
h" | 62 #include "chrome/browser/supervised_user/legacy/permission_request_creator_sync.
h" |
63 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser
vice.h" | 63 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser
vice.h" |
64 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser
vice_factory.h" | 64 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser
vice_factory.h" |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 ProfileSyncServiceFactory::GetForProfile(profile_) | 1000 ProfileSyncServiceFactory::GetForProfile(profile_) |
1001 ->ReconfigureDatatypeManager(); | 1001 ->ReconfigureDatatypeManager(); |
1002 } | 1002 } |
1003 | 1003 |
1004 void SupervisedUserService::Shutdown() { | 1004 void SupervisedUserService::Shutdown() { |
1005 if (!did_init_) | 1005 if (!did_init_) |
1006 return; | 1006 return; |
1007 DCHECK(!did_shutdown_); | 1007 DCHECK(!did_shutdown_); |
1008 did_shutdown_ = true; | 1008 did_shutdown_ = true; |
1009 if (ProfileIsSupervised()) { | 1009 if (ProfileIsSupervised()) { |
1010 content::RecordAction(UserMetricsAction("ManagedUsers_QuitBrowser")); | 1010 base::RecordAction(UserMetricsAction("ManagedUsers_QuitBrowser")); |
1011 } | 1011 } |
1012 SetActive(false); | 1012 SetActive(false); |
1013 sync_blocker_.reset(); | 1013 sync_blocker_.reset(); |
1014 | 1014 |
1015 browser_sync::ProfileSyncService* sync_service = | 1015 browser_sync::ProfileSyncService* sync_service = |
1016 ProfileSyncServiceFactory::GetForProfile(profile_); | 1016 ProfileSyncServiceFactory::GetForProfile(profile_); |
1017 | 1017 |
1018 // Can be null in tests. | 1018 // Can be null in tests. |
1019 if (sync_service) | 1019 if (sync_service) |
1020 sync_service->RemovePreferenceProvider(this); | 1020 sync_service->RemovePreferenceProvider(this); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 } | 1298 } |
1299 | 1299 |
1300 DLOG_IF(ERROR, sync->GetAuthError().state() == | 1300 DLOG_IF(ERROR, sync->GetAuthError().state() == |
1301 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS) | 1301 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS) |
1302 << "Credentials rejected"; | 1302 << "Credentials rejected"; |
1303 } | 1303 } |
1304 | 1304 |
1305 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { | 1305 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { |
1306 bool profile_became_active = profile_->IsSameProfile(browser->profile()); | 1306 bool profile_became_active = profile_->IsSameProfile(browser->profile()); |
1307 if (!is_profile_active_ && profile_became_active) | 1307 if (!is_profile_active_ && profile_became_active) |
1308 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); | 1308 base::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); |
1309 else if (is_profile_active_ && !profile_became_active) | 1309 else if (is_profile_active_ && !profile_became_active) |
1310 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); | 1310 base::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); |
1311 | 1311 |
1312 is_profile_active_ = profile_became_active; | 1312 is_profile_active_ = profile_became_active; |
1313 } | 1313 } |
1314 #endif // !defined(OS_ANDROID) | 1314 #endif // !defined(OS_ANDROID) |
1315 | 1315 |
1316 void SupervisedUserService::OnSiteListUpdated() { | 1316 void SupervisedUserService::OnSiteListUpdated() { |
1317 for (SupervisedUserServiceObserver& observer : observer_list_) | 1317 for (SupervisedUserServiceObserver& observer : observer_list_) |
1318 observer.OnURLFilterChanged(); | 1318 observer.OnURLFilterChanged(); |
1319 } | 1319 } |
OLD | NEW |