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

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: Create an IsEnabled method on TetherService. 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
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/tether/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
62 #include "chrome/browser/chromeos/tether/tether_service.h"
63 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" 63 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h"
64 #include "chrome/browser/component_updater/sth_set_component_installer.h" 64 #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" 65 #include "chrome/browser/first_run/first_run.h"
67 #include "chrome/browser/google/google_brand_chromeos.h" 66 #include "chrome/browser/google/google_brand_chromeos.h"
68 #include "chrome/browser/lifetime/application_lifetime.h" 67 #include "chrome/browser/lifetime/application_lifetime.h"
69 #include "chrome/browser/net/crl_set_fetcher.h" 68 #include "chrome/browser/net/crl_set_fetcher.h"
70 #include "chrome/browser/net/nss_context.h" 69 #include "chrome/browser/net/nss_context.h"
71 #include "chrome/browser/prefs/session_startup_pref.h" 70 #include "chrome/browser/prefs/session_startup_pref.h"
72 #include "chrome/browser/profiles/profile.h" 71 #include "chrome/browser/profiles/profile.h"
73 #include "chrome/browser/profiles/profile_manager.h" 72 #include "chrome/browser/profiles/profile_manager.h"
74 #include "chrome/browser/signin/account_tracker_service_factory.h" 73 #include "chrome/browser/signin/account_tracker_service_factory.h"
75 #include "chrome/browser/signin/easy_unlock_service.h" 74 #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" 75 #include "chrome/browser/signin/signin_manager_factory.h"
78 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" 76 #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" 77 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa ctory.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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 const user_manager::User* user = 1219 const user_manager::User* user =
1225 ProfileHelper::Get()->GetUserByProfile(profile); 1220 ProfileHelper::Get()->GetUserByProfile(profile);
1226 if (user_manager->GetPrimaryUser() == user) { 1221 if (user_manager->GetPrimaryUser() == user) {
1227 InitRlz(profile); 1222 InitRlz(profile);
1228 InitializeCerts(profile); 1223 InitializeCerts(profile);
1229 InitializeCRLSetFetcher(user); 1224 InitializeCRLSetFetcher(user);
1230 InitializeCertificateTransparencyComponents(user); 1225 InitializeCertificateTransparencyComponents(user);
1231 1226
1232 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile); 1227 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile);
1233 1228
1234 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1229 TetherService::Get(profile)->StartTether();
1235 chromeos::switches::kEnableTether)) {
1236 auto notification_presenter =
1237 base::MakeUnique<tether::TetherNotificationPresenter>(
1238 message_center::MessageCenter::Get(), NetworkConnect::Get());
1239 chromeos::tether::Initializer::Init(
1240 ChromeCryptAuthServiceFactory::GetForBrowserContext(profile),
1241 std::move(notification_presenter), profile->GetPrefs(),
1242 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
1243 NetworkHandler::Get()->network_state_handler(),
1244 NetworkConnect::Get());
1245 }
1246 } 1230 }
1247 1231
1248 UpdateEasyUnlockKeys(user_context_); 1232 UpdateEasyUnlockKeys(user_context_);
1249 user_context_.ClearSecrets(); 1233 user_context_.ClearSecrets();
1250 if (TokenHandlesEnabled()) { 1234 if (TokenHandlesEnabled()) {
1251 CreateTokenUtilIfMissing(); 1235 CreateTokenUtilIfMissing();
1252 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) { 1236 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) {
1253 if (!token_handle_fetcher_.get()) { 1237 if (!token_handle_fetcher_.get()) {
1254 token_handle_fetcher_.reset(new TokenHandleFetcher( 1238 token_handle_fetcher_.reset(new TokenHandleFetcher(
1255 token_handle_util_.get(), user->GetAccountId())); 1239 token_handle_util_.get(), user->GetAccountId()));
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 bool show_names_on_signin = true; 1902 bool show_names_on_signin = true;
1919 auto* cros_settings = CrosSettings::Get(); 1903 auto* cros_settings = CrosSettings::Get();
1920 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled, 1904 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
1921 &ephemeral_users_enabled); 1905 &ephemeral_users_enabled);
1922 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, 1906 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn,
1923 &show_names_on_signin); 1907 &show_names_on_signin);
1924 return show_names_on_signin && !ephemeral_users_enabled; 1908 return show_names_on_signin && !ephemeral_users_enabled;
1925 } 1909 }
1926 1910
1927 void UserSessionManager::Shutdown() { 1911 void UserSessionManager::Shutdown() {
1928 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1929 chromeos::switches::kEnableTether)) {
1930 chromeos::tether::Initializer::Shutdown();
1931 }
1932
1933 token_handle_fetcher_.reset(); 1912 token_handle_fetcher_.reset();
1934 token_handle_util_.reset(); 1913 token_handle_util_.reset();
1935 first_run::GoodiesDisplayer::Delete(); 1914 first_run::GoodiesDisplayer::Delete();
1936 } 1915 }
1937 1916
1938 void UserSessionManager::CreateTokenUtilIfMissing() { 1917 void UserSessionManager::CreateTokenUtilIfMissing() {
1939 if (!token_handle_util_.get()) 1918 if (!token_handle_util_.get())
1940 token_handle_util_.reset(new TokenHandleUtil()); 1919 token_handle_util_.reset(new TokenHandleUtil());
1941 } 1920 }
1942 1921
1943 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) { 1922 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) {
1944 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1923 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1945 chromeos::switches::kDisableEolNotification)) { 1924 chromeos::switches::kDisableEolNotification)) {
1946 return false; 1925 return false;
1947 } 1926 }
1948 1927
1949 // Do not show end of life notification if this device is managed by 1928 // Do not show end of life notification if this device is managed by
1950 // enterprise user. 1929 // enterprise user.
1951 if (g_browser_process->platform_part() 1930 if (g_browser_process->platform_part()
1952 ->browser_policy_connector_chromeos() 1931 ->browser_policy_connector_chromeos()
1953 ->IsEnterpriseManaged()) { 1932 ->IsEnterpriseManaged()) {
1954 return false; 1933 return false;
1955 } 1934 }
1956 1935
1957 // Do not show end of life notification if this is a guest session 1936 // Do not show end of life notification if this is a guest session
1958 return !profile->IsGuestSession(); 1937 return !profile->IsGuestSession();
1959 } 1938 }
1960 1939
1961 } // namespace chromeos 1940 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/tether/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698