| 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/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 Loading... |
| 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" |
| 59 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 60 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 60 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 61 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 61 #include "chrome/browser/chromeos/settings/cros_settings.h" | 62 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 62 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" | 63 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" |
| 63 #include "chrome/browser/component_updater/sth_set_component_installer.h" | 64 #include "chrome/browser/component_updater/sth_set_component_installer.h" |
| 64 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" | 65 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" |
| 65 #include "chrome/browser/first_run/first_run.h" | 66 #include "chrome/browser/first_run/first_run.h" |
| 66 #include "chrome/browser/google/google_brand_chromeos.h" | 67 #include "chrome/browser/google/google_brand_chromeos.h" |
| 67 #include "chrome/browser/lifetime/application_lifetime.h" | 68 #include "chrome/browser/lifetime/application_lifetime.h" |
| 68 #include "chrome/browser/net/crl_set_fetcher.h" | 69 #include "chrome/browser/net/crl_set_fetcher.h" |
| 69 #include "chrome/browser/net/nss_context.h" | 70 #include "chrome/browser/net/nss_context.h" |
| 70 #include "chrome/browser/prefs/session_startup_pref.h" | 71 #include "chrome/browser/prefs/session_startup_pref.h" |
| 71 #include "chrome/browser/profiles/profile.h" | 72 #include "chrome/browser/profiles/profile.h" |
| 72 #include "chrome/browser/profiles/profile_manager.h" | 73 #include "chrome/browser/profiles/profile_manager.h" |
| 73 #include "chrome/browser/signin/account_tracker_service_factory.h" | 74 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 74 #include "chrome/browser/signin/easy_unlock_service.h" | 75 #include "chrome/browser/signin/easy_unlock_service.h" |
| 76 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 75 #include "chrome/browser/signin/signin_manager_factory.h" | 77 #include "chrome/browser/signin/signin_manager_factory.h" |
| 76 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" | 78 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" |
| 77 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa
ctory.h" | 79 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa
ctory.h" |
| 78 #include "chrome/browser/ui/app_list/app_list_service.h" | 80 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 79 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 81 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 80 #include "chrome/common/channel_info.h" | 82 #include "chrome/common/channel_info.h" |
| 81 #include "chrome/common/chrome_switches.h" | 83 #include "chrome/common/chrome_switches.h" |
| 82 #include "chrome/common/logging_chrome.h" | 84 #include "chrome/common/logging_chrome.h" |
| 83 #include "chrome/common/pref_names.h" | 85 #include "chrome/common/pref_names.h" |
| 84 #include "chromeos/cert_loader.h" | 86 #include "chromeos/cert_loader.h" |
| 85 #include "chromeos/chromeos_switches.h" | 87 #include "chromeos/chromeos_switches.h" |
| 86 #include "chromeos/components/tether/initializer.h" | 88 #include "chromeos/components/tether/initializer.h" |
| 87 #include "chromeos/cryptohome/cryptohome_parameters.h" | 89 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 88 #include "chromeos/cryptohome/cryptohome_util.h" | 90 #include "chromeos/cryptohome/cryptohome_util.h" |
| 89 #include "chromeos/dbus/cryptohome_client.h" | 91 #include "chromeos/dbus/cryptohome_client.h" |
| 90 #include "chromeos/dbus/dbus_thread_manager.h" | 92 #include "chromeos/dbus/dbus_thread_manager.h" |
| 91 #include "chromeos/dbus/session_manager_client.h" | 93 #include "chromeos/dbus/session_manager_client.h" |
| 92 #include "chromeos/login/auth/stub_authenticator.h" | 94 #include "chromeos/login/auth/stub_authenticator.h" |
| 95 #include "chromeos/network/network_connect.h" |
| 96 #include "chromeos/network/network_state_handler.h" |
| 93 #include "chromeos/network/portal_detector/network_portal_detector.h" | 97 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 94 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" | 98 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" |
| 95 #include "chromeos/settings/cros_settings_names.h" | 99 #include "chromeos/settings/cros_settings_names.h" |
| 96 #include "components/component_updater/component_updater_service.h" | 100 #include "components/component_updater/component_updater_service.h" |
| 97 #include "components/flags_ui/pref_service_flags_storage.h" | 101 #include "components/flags_ui/pref_service_flags_storage.h" |
| 98 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 102 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 99 #include "components/prefs/pref_member.h" | 103 #include "components/prefs/pref_member.h" |
| 100 #include "components/prefs/pref_registry_simple.h" | 104 #include "components/prefs/pref_registry_simple.h" |
| 101 #include "components/prefs/pref_service.h" | 105 #include "components/prefs/pref_service.h" |
| 102 #include "components/quirks/quirks_manager.h" | 106 #include "components/quirks/quirks_manager.h" |
| 103 #include "components/session_manager/core/session_manager.h" | 107 #include "components/session_manager/core/session_manager.h" |
| 104 #include "components/signin/core/account_id/account_id.h" | 108 #include "components/signin/core/account_id/account_id.h" |
| 105 #include "components/signin/core/browser/account_tracker_service.h" | 109 #include "components/signin/core/browser/account_tracker_service.h" |
| 106 #include "components/signin/core/browser/signin_manager_base.h" | 110 #include "components/signin/core/browser/signin_manager_base.h" |
| 107 #include "components/user_manager/known_user.h" | 111 #include "components/user_manager/known_user.h" |
| 108 #include "components/user_manager/user.h" | 112 #include "components/user_manager/user.h" |
| 109 #include "components/user_manager/user_manager.h" | 113 #include "components/user_manager/user_manager.h" |
| 110 #include "components/user_manager/user_names.h" | 114 #include "components/user_manager/user_names.h" |
| 111 #include "components/user_manager/user_type.h" | 115 #include "components/user_manager/user_type.h" |
| 112 #include "components/version_info/version_info.h" | 116 #include "components/version_info/version_info.h" |
| 113 #include "content/public/browser/browser_thread.h" | 117 #include "content/public/browser/browser_thread.h" |
| 114 #include "content/public/browser/notification_service.h" | 118 #include "content/public/browser/notification_service.h" |
| 115 #include "content/public/browser/storage_partition.h" | 119 #include "content/public/browser/storage_partition.h" |
| 116 #include "content/public/common/content_switches.h" | 120 #include "content/public/common/content_switches.h" |
| 117 #include "extensions/common/features/feature_session_type.h" | 121 #include "extensions/common/features/feature_session_type.h" |
| 118 #include "net/cert/sth_distributor.h" | 122 #include "net/cert/sth_distributor.h" |
| 119 #include "rlz/features/features.h" | 123 #include "rlz/features/features.h" |
| 120 #include "ui/base/ime/chromeos/input_method_descriptor.h" | 124 #include "ui/base/ime/chromeos/input_method_descriptor.h" |
| 121 #include "ui/base/ime/chromeos/input_method_manager.h" | 125 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 126 #include "ui/message_center/message_center.h" |
| 122 #include "url/gurl.h" | 127 #include "url/gurl.h" |
| 123 | 128 |
| 124 #if BUILDFLAG(ENABLE_RLZ) | 129 #if BUILDFLAG(ENABLE_RLZ) |
| 125 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" | 130 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" |
| 126 #include "components/rlz/rlz_tracker.h" | 131 #include "components/rlz/rlz_tracker.h" |
| 127 #endif | 132 #endif |
| 128 | 133 |
| 129 namespace chromeos { | 134 namespace chromeos { |
| 130 | 135 |
| 131 namespace { | 136 namespace { |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 if (user_manager->GetPrimaryUser() == user) { | 1245 if (user_manager->GetPrimaryUser() == user) { |
| 1241 InitRlz(profile); | 1246 InitRlz(profile); |
| 1242 InitializeCerts(profile); | 1247 InitializeCerts(profile); |
| 1243 InitializeCRLSetFetcher(user); | 1248 InitializeCRLSetFetcher(user); |
| 1244 InitializeCertificateTransparencyComponents(user); | 1249 InitializeCertificateTransparencyComponents(user); |
| 1245 | 1250 |
| 1246 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile); | 1251 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile); |
| 1247 | 1252 |
| 1248 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1253 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1249 chromeos::switches::kEnableTether)) { | 1254 chromeos::switches::kEnableTether)) { |
| 1250 chromeos::tether::Initializer::Initialize( | 1255 auto notification_presenter = |
| 1251 ChromeCryptAuthServiceFactory::GetForBrowserContext(profile)); | 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()); |
| 1252 } | 1264 } |
| 1253 } | 1265 } |
| 1254 | 1266 |
| 1255 UpdateEasyUnlockKeys(user_context_); | 1267 UpdateEasyUnlockKeys(user_context_); |
| 1256 user_context_.ClearSecrets(); | 1268 user_context_.ClearSecrets(); |
| 1257 if (TokenHandlesEnabled()) { | 1269 if (TokenHandlesEnabled()) { |
| 1258 CreateTokenUtilIfMissing(); | 1270 CreateTokenUtilIfMissing(); |
| 1259 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) { | 1271 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) { |
| 1260 if (!token_handle_fetcher_.get()) { | 1272 if (!token_handle_fetcher_.get()) { |
| 1261 token_handle_fetcher_.reset(new TokenHandleFetcher( | 1273 token_handle_fetcher_.reset(new TokenHandleFetcher( |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1925 bool show_names_on_signin = true; | 1937 bool show_names_on_signin = true; |
| 1926 auto* cros_settings = CrosSettings::Get(); | 1938 auto* cros_settings = CrosSettings::Get(); |
| 1927 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled, | 1939 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled, |
| 1928 &ephemeral_users_enabled); | 1940 &ephemeral_users_enabled); |
| 1929 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, | 1941 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, |
| 1930 &show_names_on_signin); | 1942 &show_names_on_signin); |
| 1931 return show_names_on_signin && !ephemeral_users_enabled; | 1943 return show_names_on_signin && !ephemeral_users_enabled; |
| 1932 } | 1944 } |
| 1933 | 1945 |
| 1934 void UserSessionManager::Shutdown() { | 1946 void UserSessionManager::Shutdown() { |
| 1947 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1948 chromeos::switches::kEnableTether)) { |
| 1949 chromeos::tether::Initializer::Shutdown(); |
| 1950 } |
| 1951 |
| 1935 token_handle_fetcher_.reset(); | 1952 token_handle_fetcher_.reset(); |
| 1936 token_handle_util_.reset(); | 1953 token_handle_util_.reset(); |
| 1937 first_run::GoodiesDisplayer::Delete(); | 1954 first_run::GoodiesDisplayer::Delete(); |
| 1938 } | 1955 } |
| 1939 | 1956 |
| 1940 void UserSessionManager::CreateTokenUtilIfMissing() { | 1957 void UserSessionManager::CreateTokenUtilIfMissing() { |
| 1941 if (!token_handle_util_.get()) | 1958 if (!token_handle_util_.get()) |
| 1942 token_handle_util_.reset(new TokenHandleUtil()); | 1959 token_handle_util_.reset(new TokenHandleUtil()); |
| 1943 } | 1960 } |
| 1944 | 1961 |
| 1945 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) { | 1962 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) { |
| 1946 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1963 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1947 chromeos::switches::kDisableEolNotification)) { | 1964 chromeos::switches::kDisableEolNotification)) { |
| 1948 return false; | 1965 return false; |
| 1949 } | 1966 } |
| 1950 | 1967 |
| 1951 // Do not show end of life notification if this device is managed by | 1968 // Do not show end of life notification if this device is managed by |
| 1952 // enterprise user. | 1969 // enterprise user. |
| 1953 if (g_browser_process->platform_part() | 1970 if (g_browser_process->platform_part() |
| 1954 ->browser_policy_connector_chromeos() | 1971 ->browser_policy_connector_chromeos() |
| 1955 ->IsEnterpriseManaged()) { | 1972 ->IsEnterpriseManaged()) { |
| 1956 return false; | 1973 return false; |
| 1957 } | 1974 } |
| 1958 | 1975 |
| 1959 // Do not show end of life notification if this is a guest session | 1976 // Do not show end of life notification if this is a guest session |
| 1960 return !profile->IsGuestSession(); | 1977 return !profile->IsGuestSession(); |
| 1961 } | 1978 } |
| 1962 | 1979 |
| 1963 } // namespace chromeos | 1980 } // namespace chromeos |
| OLD | NEW |