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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 #include "chrome/browser/chromeos/login/startup_utils.h" | 40 #include "chrome/browser/chromeos/login/startup_utils.h" |
41 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 41 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
42 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 42 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
43 #include "chrome/browser/chromeos/login/user_flow.h" | 43 #include "chrome/browser/chromeos/login/user_flow.h" |
44 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 44 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
45 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 45 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
46 #include "chrome/browser/chromeos/login/wizard_controller.h" | 46 #include "chrome/browser/chromeos/login/wizard_controller.h" |
47 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 47 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
48 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 48 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
49 #include "chrome/browser/chromeos/settings/cros_settings.h" | 49 #include "chrome/browser/chromeos/settings/cros_settings.h" |
50 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" | |
50 #include "chrome/browser/first_run/first_run.h" | 51 #include "chrome/browser/first_run/first_run.h" |
51 #include "chrome/browser/google/google_brand_chromeos.h" | 52 #include "chrome/browser/google/google_brand_chromeos.h" |
52 #include "chrome/browser/lifetime/application_lifetime.h" | 53 #include "chrome/browser/lifetime/application_lifetime.h" |
53 #include "chrome/browser/net/crl_set_fetcher.h" | 54 #include "chrome/browser/net/crl_set_fetcher.h" |
54 #include "chrome/browser/net/nss_context.h" | 55 #include "chrome/browser/net/nss_context.h" |
55 #include "chrome/browser/prefs/session_startup_pref.h" | 56 #include "chrome/browser/prefs/session_startup_pref.h" |
56 #include "chrome/browser/profiles/profile.h" | 57 #include "chrome/browser/profiles/profile.h" |
57 #include "chrome/browser/profiles/profile_manager.h" | 58 #include "chrome/browser/profiles/profile_manager.h" |
58 #include "chrome/browser/rlz/rlz.h" | 59 #include "chrome/browser/rlz/rlz.h" |
59 #include "chrome/browser/signin/account_tracker_service_factory.h" | 60 #include "chrome/browser/signin/account_tracker_service_factory.h" |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
869 content::NotificationService::AllSources(), | 870 content::NotificationService::AllSources(), |
870 content::Details<Profile>(profile)); | 871 content::Details<Profile>(profile)); |
871 | 872 |
872 // Initialize various services only for primary user. | 873 // Initialize various services only for primary user. |
873 const user_manager::User* user = | 874 const user_manager::User* user = |
874 ProfileHelper::Get()->GetUserByProfile(profile); | 875 ProfileHelper::Get()->GetUserByProfile(profile); |
875 if (user_manager->GetPrimaryUser() == user) { | 876 if (user_manager->GetPrimaryUser() == user) { |
876 InitRlz(profile); | 877 InitRlz(profile); |
877 InitializeCerts(profile); | 878 InitializeCerts(profile); |
878 InitializeCRLSetFetcher(user); | 879 InitializeCRLSetFetcher(user); |
880 InitializeEVCertificatesWhitelistComponent(user); | |
879 } | 881 } |
880 | 882 |
881 UpdateEasyUnlockKeys(user_context_); | 883 UpdateEasyUnlockKeys(user_context_); |
882 user_context_.ClearSecrets(); | 884 user_context_.ClearSecrets(); |
883 | 885 |
884 // Now that profile is ready, proceed to either alternative login flows or | 886 // Now that profile is ready, proceed to either alternative login flows or |
885 // launch browser. | 887 // launch browser. |
886 bool browser_launched = InitializeUserSession(profile); | 888 bool browser_launched = InitializeUserSession(profile); |
887 | 889 |
888 // TODO(nkostylev): This pointer should probably never be NULL, but it looks | 890 // TODO(nkostylev): This pointer should probably never be NULL, but it looks |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1102 base::FilePath path; | 1104 base::FilePath path; |
1103 path = ProfileHelper::GetProfilePathByUserIdHash(username_hash); | 1105 path = ProfileHelper::GetProfilePathByUserIdHash(username_hash); |
1104 component_updater::ComponentUpdateService* cus = | 1106 component_updater::ComponentUpdateService* cus = |
1105 g_browser_process->component_updater(); | 1107 g_browser_process->component_updater(); |
1106 CRLSetFetcher* crl_set = g_browser_process->crl_set_fetcher(); | 1108 CRLSetFetcher* crl_set = g_browser_process->crl_set_fetcher(); |
1107 if (crl_set && cus) | 1109 if (crl_set && cus) |
1108 crl_set->StartInitialLoad(cus, path); | 1110 crl_set->StartInitialLoad(cus, path); |
1109 } | 1111 } |
1110 } | 1112 } |
1111 | 1113 |
1114 void UserSessionManager::InitializeEVCertificatesWhitelistComponent( | |
1115 const user_manager::User* user) { | |
1116 const std::string username_hash = user->username_hash(); | |
1117 component_updater::ComponentUpdateService* cus = | |
1118 g_browser_process->component_updater(); | |
1119 if (!username_hash.empty() && cus) { | |
1120 base::FilePath path; | |
Sorin Jianu
2014/11/07 17:30:44
path can be initialized here and be declared const
Eran Messeri
2014/11/10 22:54:56
Done.
| |
1121 path = ProfileHelper::GetProfilePathByUserIdHash(username_hash); | |
1122 RegisterEVWhitelistComponent(cus, path); | |
1123 } | |
1124 } | |
1125 | |
1112 void UserSessionManager::OnRestoreActiveSessions( | 1126 void UserSessionManager::OnRestoreActiveSessions( |
1113 const SessionManagerClient::ActiveSessionsMap& sessions, | 1127 const SessionManagerClient::ActiveSessionsMap& sessions, |
1114 bool success) { | 1128 bool success) { |
1115 if (!success) { | 1129 if (!success) { |
1116 LOG(ERROR) << "Could not get list of active user sessions after crash."; | 1130 LOG(ERROR) << "Could not get list of active user sessions after crash."; |
1117 // If we could not get list of active user sessions it is safer to just | 1131 // If we could not get list of active user sessions it is safer to just |
1118 // sign out so that we don't get in the inconsistent state. | 1132 // sign out so that we don't get in the inconsistent state. |
1119 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); | 1133 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); |
1120 return; | 1134 return; |
1121 } | 1135 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1281 } | 1295 } |
1282 | 1296 |
1283 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { | 1297 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { |
1284 if (!easy_unlock_key_manager_) | 1298 if (!easy_unlock_key_manager_) |
1285 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1299 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
1286 | 1300 |
1287 return easy_unlock_key_manager_.get(); | 1301 return easy_unlock_key_manager_.get(); |
1288 } | 1302 } |
1289 | 1303 |
1290 } // namespace chromeos | 1304 } // namespace chromeos |
OLD | NEW |