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

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

Issue 2801353002: [CrOS Tether] Fill out the Initializer class. Tether will now initialize fully once the flag is ena… (Closed)
Patch Set: stevenjb@ comments. 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" 50 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
51 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" 51 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h"
52 #include "chrome/browser/chromeos/login/signin/token_handle_fetcher.h" 52 #include "chrome/browser/chromeos/login/signin/token_handle_fetcher.h"
53 #include "chrome/browser/chromeos/login/startup_utils.h" 53 #include "chrome/browser/chromeos/login/startup_utils.h"
54 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" 54 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h"
55 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 55 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
56 #include "chrome/browser/chromeos/login/user_flow.h" 56 #include "chrome/browser/chromeos/login/user_flow.h"
57 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 57 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
58 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 58 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
59 #include "chrome/browser/chromeos/login/wizard_controller.h" 59 #include "chrome/browser/chromeos/login/wizard_controller.h"
60 #include "chrome/browser/chromeos/net/tether_notification_presenter.h"
60 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 61 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
61 #include "chrome/browser/chromeos/profiles/profile_helper.h" 62 #include "chrome/browser/chromeos/profiles/profile_helper.h"
62 #include "chrome/browser/chromeos/settings/cros_settings.h" 63 #include "chrome/browser/chromeos/settings/cros_settings.h"
63 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" 64 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h"
64 #include "chrome/browser/component_updater/sth_set_component_installer.h" 65 #include "chrome/browser/component_updater/sth_set_component_installer.h"
65 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" 66 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
66 #include "chrome/browser/first_run/first_run.h" 67 #include "chrome/browser/first_run/first_run.h"
67 #include "chrome/browser/google/google_brand_chromeos.h" 68 #include "chrome/browser/google/google_brand_chromeos.h"
68 #include "chrome/browser/lifetime/application_lifetime.h" 69 #include "chrome/browser/lifetime/application_lifetime.h"
69 #include "chrome/browser/net/crl_set_fetcher.h" 70 #include "chrome/browser/net/crl_set_fetcher.h"
70 #include "chrome/browser/net/nss_context.h" 71 #include "chrome/browser/net/nss_context.h"
71 #include "chrome/browser/prefs/session_startup_pref.h" 72 #include "chrome/browser/prefs/session_startup_pref.h"
72 #include "chrome/browser/profiles/profile.h" 73 #include "chrome/browser/profiles/profile.h"
73 #include "chrome/browser/profiles/profile_manager.h" 74 #include "chrome/browser/profiles/profile_manager.h"
74 #include "chrome/browser/signin/account_tracker_service_factory.h" 75 #include "chrome/browser/signin/account_tracker_service_factory.h"
75 #include "chrome/browser/signin/easy_unlock_service.h" 76 #include "chrome/browser/signin/easy_unlock_service.h"
77 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
76 #include "chrome/browser/signin/signin_manager_factory.h" 78 #include "chrome/browser/signin/signin_manager_factory.h"
77 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" 79 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
78 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa ctory.h" 80 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa ctory.h"
79 #include "chrome/browser/ui/app_list/app_list_service.h" 81 #include "chrome/browser/ui/app_list/app_list_service.h"
80 #include "chrome/browser/ui/startup/startup_browser_creator.h" 82 #include "chrome/browser/ui/startup/startup_browser_creator.h"
81 #include "chrome/common/channel_info.h" 83 #include "chrome/common/channel_info.h"
82 #include "chrome/common/chrome_switches.h" 84 #include "chrome/common/chrome_switches.h"
83 #include "chrome/common/logging_chrome.h" 85 #include "chrome/common/logging_chrome.h"
84 #include "chrome/common/pref_names.h" 86 #include "chrome/common/pref_names.h"
85 #include "chromeos/cert_loader.h" 87 #include "chromeos/cert_loader.h"
86 #include "chromeos/chromeos_switches.h" 88 #include "chromeos/chromeos_switches.h"
87 #include "chromeos/components/tether/initializer.h" 89 #include "chromeos/components/tether/initializer.h"
88 #include "chromeos/cryptohome/cryptohome_parameters.h" 90 #include "chromeos/cryptohome/cryptohome_parameters.h"
89 #include "chromeos/cryptohome/cryptohome_util.h" 91 #include "chromeos/cryptohome/cryptohome_util.h"
90 #include "chromeos/dbus/cryptohome_client.h" 92 #include "chromeos/dbus/cryptohome_client.h"
91 #include "chromeos/dbus/dbus_thread_manager.h" 93 #include "chromeos/dbus/dbus_thread_manager.h"
92 #include "chromeos/dbus/session_manager_client.h" 94 #include "chromeos/dbus/session_manager_client.h"
93 #include "chromeos/login/auth/stub_authenticator.h" 95 #include "chromeos/login/auth/stub_authenticator.h"
96 #include "chromeos/network/network_connect.h"
97 #include "chromeos/network/network_state_handler.h"
94 #include "chromeos/network/portal_detector/network_portal_detector.h" 98 #include "chromeos/network/portal_detector/network_portal_detector.h"
95 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" 99 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h"
96 #include "chromeos/settings/cros_settings_names.h" 100 #include "chromeos/settings/cros_settings_names.h"
97 #include "components/component_updater/component_updater_service.h" 101 #include "components/component_updater/component_updater_service.h"
98 #include "components/flags_ui/pref_service_flags_storage.h" 102 #include "components/flags_ui/pref_service_flags_storage.h"
99 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 103 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
100 #include "components/prefs/pref_member.h" 104 #include "components/prefs/pref_member.h"
101 #include "components/prefs/pref_registry_simple.h" 105 #include "components/prefs/pref_registry_simple.h"
102 #include "components/prefs/pref_service.h" 106 #include "components/prefs/pref_service.h"
103 #include "components/quirks/quirks_manager.h" 107 #include "components/quirks/quirks_manager.h"
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 if (user_manager->GetPrimaryUser() == user) { 1251 if (user_manager->GetPrimaryUser() == user) {
1248 InitRlz(profile); 1252 InitRlz(profile);
1249 InitializeCerts(profile); 1253 InitializeCerts(profile);
1250 InitializeCRLSetFetcher(user); 1254 InitializeCRLSetFetcher(user);
1251 InitializeCertificateTransparencyComponents(user); 1255 InitializeCertificateTransparencyComponents(user);
1252 1256
1253 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile); 1257 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile);
1254 1258
1255 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1259 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1256 chromeos::switches::kEnableTether)) { 1260 chromeos::switches::kEnableTether)) {
1257 chromeos::tether::Initializer::Initialize( 1261 auto notification_presenter =
1258 ChromeCryptAuthServiceFactory::GetForBrowserContext(profile)); 1262 base::MakeUnique<tether::TetherNotificationPresenter>();
1263 chromeos::tether::Initializer::Start(
1264 ChromeCryptAuthServiceFactory::GetForBrowserContext(profile),
1265 std::move(notification_presenter), profile->GetPrefs(),
1266 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
1267 NetworkHandler::Get()->network_state_handler(),
1268 NetworkConnect::Get());
1259 } 1269 }
1260 } 1270 }
1261 1271
1262 UpdateEasyUnlockKeys(user_context_); 1272 UpdateEasyUnlockKeys(user_context_);
1263 user_context_.ClearSecrets(); 1273 user_context_.ClearSecrets();
1264 if (TokenHandlesEnabled()) { 1274 if (TokenHandlesEnabled()) {
1265 CreateTokenUtilIfMissing(); 1275 CreateTokenUtilIfMissing();
1266 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) { 1276 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) {
1267 if (!token_handle_fetcher_.get()) { 1277 if (!token_handle_fetcher_.get()) {
1268 token_handle_fetcher_.reset(new TokenHandleFetcher( 1278 token_handle_fetcher_.reset(new TokenHandleFetcher(
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 bool show_names_on_signin = true; 1951 bool show_names_on_signin = true;
1942 auto* cros_settings = CrosSettings::Get(); 1952 auto* cros_settings = CrosSettings::Get();
1943 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled, 1953 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
1944 &ephemeral_users_enabled); 1954 &ephemeral_users_enabled);
1945 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, 1955 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn,
1946 &show_names_on_signin); 1956 &show_names_on_signin);
1947 return show_names_on_signin && !ephemeral_users_enabled; 1957 return show_names_on_signin && !ephemeral_users_enabled;
1948 } 1958 }
1949 1959
1950 void UserSessionManager::Shutdown() { 1960 void UserSessionManager::Shutdown() {
1961 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1962 chromeos::switches::kEnableTether)) {
1963 chromeos::tether::Initializer::Shutdown();
1964 }
1965
1951 token_handle_fetcher_.reset(); 1966 token_handle_fetcher_.reset();
1952 token_handle_util_.reset(); 1967 token_handle_util_.reset();
1953 first_run::GoodiesDisplayer::Delete(); 1968 first_run::GoodiesDisplayer::Delete();
1954 } 1969 }
1955 1970
1956 void UserSessionManager::CreateTokenUtilIfMissing() { 1971 void UserSessionManager::CreateTokenUtilIfMissing() {
1957 if (!token_handle_util_.get()) 1972 if (!token_handle_util_.get())
1958 token_handle_util_.reset(new TokenHandleUtil()); 1973 token_handle_util_.reset(new TokenHandleUtil());
1959 } 1974 }
1960 1975
1961 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) { 1976 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) {
1962 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1977 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1963 chromeos::switches::kDisableEolNotification)) { 1978 chromeos::switches::kDisableEolNotification)) {
1964 return false; 1979 return false;
1965 } 1980 }
1966 1981
1967 // Do not show end of life notification if this device is managed by 1982 // Do not show end of life notification if this device is managed by
1968 // enterprise user. 1983 // enterprise user.
1969 if (g_browser_process->platform_part() 1984 if (g_browser_process->platform_part()
1970 ->browser_policy_connector_chromeos() 1985 ->browser_policy_connector_chromeos()
1971 ->IsEnterpriseManaged()) { 1986 ->IsEnterpriseManaged()) {
1972 return false; 1987 return false;
1973 } 1988 }
1974 1989
1975 // Do not show end of life notification if this is a guest session 1990 // Do not show end of life notification if this is a guest session
1976 return !profile->IsGuestSession(); 1991 return !profile->IsGuestSession();
1977 } 1992 }
1978 1993
1979 } // namespace chromeos 1994 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/components/tether/BUILD.gn » ('j') | chromeos/components/tether/initializer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698