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

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 2819713002: Create TetherService, a TetherAllowed pref, and use DependencyManager for RegisterProfilePrefs call… (Closed)
Patch Set: Created 3 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/chromeos/login/session/user_session_manager.h" 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" 49 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
50 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" 50 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h"
51 #include "chrome/browser/chromeos/login/signin/token_handle_fetcher.h" 51 #include "chrome/browser/chromeos/login/signin/token_handle_fetcher.h"
52 #include "chrome/browser/chromeos/login/startup_utils.h" 52 #include "chrome/browser/chromeos/login/startup_utils.h"
53 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" 53 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h"
54 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 54 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
55 #include "chrome/browser/chromeos/login/user_flow.h" 55 #include "chrome/browser/chromeos/login/user_flow.h"
56 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 56 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
57 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 57 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
58 #include "chrome/browser/chromeos/login/wizard_controller.h" 58 #include "chrome/browser/chromeos/login/wizard_controller.h"
59 #include "chrome/browser/chromeos/net/tether_notification_presenter.h"
60 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 59 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
61 #include "chrome/browser/chromeos/profiles/profile_helper.h" 60 #include "chrome/browser/chromeos/profiles/profile_helper.h"
62 #include "chrome/browser/chromeos/settings/cros_settings.h" 61 #include "chrome/browser/chromeos/settings/cros_settings.h"
63 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" 62 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h"
64 #include "chrome/browser/component_updater/sth_set_component_installer.h" 63 #include "chrome/browser/component_updater/sth_set_component_installer.h"
65 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
66 #include "chrome/browser/first_run/first_run.h" 64 #include "chrome/browser/first_run/first_run.h"
67 #include "chrome/browser/google/google_brand_chromeos.h" 65 #include "chrome/browser/google/google_brand_chromeos.h"
68 #include "chrome/browser/lifetime/application_lifetime.h" 66 #include "chrome/browser/lifetime/application_lifetime.h"
69 #include "chrome/browser/net/crl_set_fetcher.h" 67 #include "chrome/browser/net/crl_set_fetcher.h"
70 #include "chrome/browser/net/nss_context.h" 68 #include "chrome/browser/net/nss_context.h"
71 #include "chrome/browser/prefs/session_startup_pref.h" 69 #include "chrome/browser/prefs/session_startup_pref.h"
72 #include "chrome/browser/profiles/profile.h" 70 #include "chrome/browser/profiles/profile.h"
73 #include "chrome/browser/profiles/profile_manager.h" 71 #include "chrome/browser/profiles/profile_manager.h"
74 #include "chrome/browser/signin/account_tracker_service_factory.h" 72 #include "chrome/browser/signin/account_tracker_service_factory.h"
75 #include "chrome/browser/signin/easy_unlock_service.h" 73 #include "chrome/browser/signin/easy_unlock_service.h"
76 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
77 #include "chrome/browser/signin/signin_manager_factory.h" 74 #include "chrome/browser/signin/signin_manager_factory.h"
78 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" 75 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
79 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa ctory.h" 76 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa ctory.h"
77 #include "chrome/browser/tether/tether_service.h"
80 #include "chrome/browser/ui/app_list/app_list_service.h" 78 #include "chrome/browser/ui/app_list/app_list_service.h"
81 #include "chrome/browser/ui/startup/startup_browser_creator.h" 79 #include "chrome/browser/ui/startup/startup_browser_creator.h"
82 #include "chrome/common/channel_info.h" 80 #include "chrome/common/channel_info.h"
83 #include "chrome/common/chrome_switches.h" 81 #include "chrome/common/chrome_switches.h"
84 #include "chrome/common/logging_chrome.h" 82 #include "chrome/common/logging_chrome.h"
85 #include "chrome/common/pref_names.h" 83 #include "chrome/common/pref_names.h"
86 #include "chromeos/cert_loader.h" 84 #include "chromeos/cert_loader.h"
87 #include "chromeos/chromeos_switches.h" 85 #include "chromeos/chromeos_switches.h"
88 #include "chromeos/components/tether/initializer.h"
89 #include "chromeos/cryptohome/cryptohome_parameters.h" 86 #include "chromeos/cryptohome/cryptohome_parameters.h"
90 #include "chromeos/cryptohome/cryptohome_util.h" 87 #include "chromeos/cryptohome/cryptohome_util.h"
91 #include "chromeos/dbus/cryptohome_client.h" 88 #include "chromeos/dbus/cryptohome_client.h"
92 #include "chromeos/dbus/dbus_thread_manager.h" 89 #include "chromeos/dbus/dbus_thread_manager.h"
93 #include "chromeos/dbus/session_manager_client.h" 90 #include "chromeos/dbus/session_manager_client.h"
94 #include "chromeos/login/auth/stub_authenticator.h" 91 #include "chromeos/login/auth/stub_authenticator.h"
95 #include "chromeos/network/network_connect.h"
96 #include "chromeos/network/network_state_handler.h"
97 #include "chromeos/network/portal_detector/network_portal_detector.h" 92 #include "chromeos/network/portal_detector/network_portal_detector.h"
98 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" 93 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h"
99 #include "chromeos/settings/cros_settings_names.h" 94 #include "chromeos/settings/cros_settings_names.h"
100 #include "components/component_updater/component_updater_service.h" 95 #include "components/component_updater/component_updater_service.h"
101 #include "components/flags_ui/pref_service_flags_storage.h" 96 #include "components/flags_ui/pref_service_flags_storage.h"
102 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 97 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
103 #include "components/prefs/pref_member.h" 98 #include "components/prefs/pref_member.h"
104 #include "components/prefs/pref_registry_simple.h" 99 #include "components/prefs/pref_registry_simple.h"
105 #include "components/prefs/pref_service.h" 100 #include "components/prefs/pref_service.h"
106 #include "components/quirks/quirks_manager.h" 101 #include "components/quirks/quirks_manager.h"
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 const user_manager::User* user = 1238 const user_manager::User* user =
1244 ProfileHelper::Get()->GetUserByProfile(profile); 1239 ProfileHelper::Get()->GetUserByProfile(profile);
1245 if (user_manager->GetPrimaryUser() == user) { 1240 if (user_manager->GetPrimaryUser() == user) {
1246 InitRlz(profile); 1241 InitRlz(profile);
1247 InitializeCerts(profile); 1242 InitializeCerts(profile);
1248 InitializeCRLSetFetcher(user); 1243 InitializeCRLSetFetcher(user);
1249 InitializeCertificateTransparencyComponents(user); 1244 InitializeCertificateTransparencyComponents(user);
1250 1245
1251 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile); 1246 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile);
1252 1247
1253 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1248 TetherService* tether_service = TetherService::Get(profile);
1254 chromeos::switches::kEnableTether)) { 1249 if (tether_service) {
1255 auto notification_presenter = 1250 tether_service->StartTether();
1256 base::MakeUnique<tether::TetherNotificationPresenter>(
1257 message_center::MessageCenter::Get(), NetworkConnect::Get());
1258 chromeos::tether::Initializer::Init(
1259 ChromeCryptAuthServiceFactory::GetForBrowserContext(profile),
1260 std::move(notification_presenter), profile->GetPrefs(),
1261 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
1262 NetworkHandler::Get()->network_state_handler(),
1263 NetworkConnect::Get());
1264 } 1251 }
1265 } 1252 }
1266 1253
1267 UpdateEasyUnlockKeys(user_context_); 1254 UpdateEasyUnlockKeys(user_context_);
1268 user_context_.ClearSecrets(); 1255 user_context_.ClearSecrets();
1269 if (TokenHandlesEnabled()) { 1256 if (TokenHandlesEnabled()) {
1270 CreateTokenUtilIfMissing(); 1257 CreateTokenUtilIfMissing();
1271 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) { 1258 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) {
1272 if (!token_handle_fetcher_.get()) { 1259 if (!token_handle_fetcher_.get()) {
1273 token_handle_fetcher_.reset(new TokenHandleFetcher( 1260 token_handle_fetcher_.reset(new TokenHandleFetcher(
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 bool show_names_on_signin = true; 1924 bool show_names_on_signin = true;
1938 auto* cros_settings = CrosSettings::Get(); 1925 auto* cros_settings = CrosSettings::Get();
1939 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled, 1926 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
1940 &ephemeral_users_enabled); 1927 &ephemeral_users_enabled);
1941 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, 1928 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn,
1942 &show_names_on_signin); 1929 &show_names_on_signin);
1943 return show_names_on_signin && !ephemeral_users_enabled; 1930 return show_names_on_signin && !ephemeral_users_enabled;
1944 } 1931 }
1945 1932
1946 void UserSessionManager::Shutdown() { 1933 void UserSessionManager::Shutdown() {
1947 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
Kyle Horimoto 2017/04/14 00:15:43 When will Shutdown() be called now? Are we sure th
Ryan Hansberry 2017/04/14 02:34:10 Initializer::Shutdown() is now called when either
Kyle Horimoto 2017/04/14 18:39:20 Have you confirmed that Initializer::Shutdown() wi
Ryan Hansberry 2017/04/18 17:59:05 Good catch. Added a call to TetherService::Shutdow
Ryan Hansberry 2017/04/18 21:59:53 Actually, this code was correct the first time. I
1948 chromeos::switches::kEnableTether)) {
1949 chromeos::tether::Initializer::Shutdown();
1950 }
1951
1952 token_handle_fetcher_.reset(); 1934 token_handle_fetcher_.reset();
1953 token_handle_util_.reset(); 1935 token_handle_util_.reset();
1954 first_run::GoodiesDisplayer::Delete(); 1936 first_run::GoodiesDisplayer::Delete();
1955 } 1937 }
1956 1938
1957 void UserSessionManager::CreateTokenUtilIfMissing() { 1939 void UserSessionManager::CreateTokenUtilIfMissing() {
1958 if (!token_handle_util_.get()) 1940 if (!token_handle_util_.get())
1959 token_handle_util_.reset(new TokenHandleUtil()); 1941 token_handle_util_.reset(new TokenHandleUtil());
1960 } 1942 }
1961 1943
1962 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) { 1944 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) {
1963 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1945 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1964 chromeos::switches::kDisableEolNotification)) { 1946 chromeos::switches::kDisableEolNotification)) {
1965 return false; 1947 return false;
1966 } 1948 }
1967 1949
1968 // Do not show end of life notification if this device is managed by 1950 // Do not show end of life notification if this device is managed by
1969 // enterprise user. 1951 // enterprise user.
1970 if (g_browser_process->platform_part() 1952 if (g_browser_process->platform_part()
1971 ->browser_policy_connector_chromeos() 1953 ->browser_policy_connector_chromeos()
1972 ->IsEnterpriseManaged()) { 1954 ->IsEnterpriseManaged()) {
1973 return false; 1955 return false;
1974 } 1956 }
1975 1957
1976 // Do not show end of life notification if this is a guest session 1958 // Do not show end of life notification if this is a guest session
1977 return !profile->IsGuestSession(); 1959 return !profile->IsGuestSession();
1978 } 1960 }
1979 1961
1980 } // namespace chromeos 1962 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698