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

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

Issue 419013003: Replace c/b/nss_context by a KeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Flattened components/cert_database folders. Created 6 years, 1 month 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 | Annotate | Revision Log
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 <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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/first_run/first_run.h" 50 #include "chrome/browser/first_run/first_run.h"
51 #include "chrome/browser/google/google_brand_chromeos.h" 51 #include "chrome/browser/google/google_brand_chromeos.h"
52 #include "chrome/browser/lifetime/application_lifetime.h" 52 #include "chrome/browser/lifetime/application_lifetime.h"
53 #include "chrome/browser/net/crl_set_fetcher.h" 53 #include "chrome/browser/net/crl_set_fetcher.h"
54 #include "chrome/browser/net/nss_context.h"
55 #include "chrome/browser/prefs/session_startup_pref.h" 54 #include "chrome/browser/prefs/session_startup_pref.h"
56 #include "chrome/browser/profiles/profile.h" 55 #include "chrome/browser/profiles/profile.h"
57 #include "chrome/browser/profiles/profile_manager.h" 56 #include "chrome/browser/profiles/profile_manager.h"
58 #include "chrome/browser/rlz/rlz.h" 57 #include "chrome/browser/rlz/rlz.h"
59 #include "chrome/browser/signin/account_tracker_service_factory.h" 58 #include "chrome/browser/signin/account_tracker_service_factory.h"
60 #include "chrome/browser/signin/easy_unlock_service.h" 59 #include "chrome/browser/signin/easy_unlock_service.h"
61 #include "chrome/browser/signin/signin_manager_factory.h" 60 #include "chrome/browser/signin/signin_manager_factory.h"
62 #include "chrome/common/chrome_switches.h" 61 #include "chrome/common/chrome_switches.h"
63 #include "chrome/common/logging_chrome.h" 62 #include "chrome/common/logging_chrome.h"
64 #include "chrome/common/pref_names.h" 63 #include "chrome/common/pref_names.h"
65 #include "chromeos/cert_loader.h"
66 #include "chromeos/chromeos_switches.h" 64 #include "chromeos/chromeos_switches.h"
67 #include "chromeos/cryptohome/cryptohome_util.h" 65 #include "chromeos/cryptohome/cryptohome_util.h"
68 #include "chromeos/dbus/cryptohome_client.h" 66 #include "chromeos/dbus/cryptohome_client.h"
69 #include "chromeos/dbus/dbus_thread_manager.h" 67 #include "chromeos/dbus/dbus_thread_manager.h"
70 #include "chromeos/dbus/session_manager_client.h" 68 #include "chromeos/dbus/session_manager_client.h"
71 #include "chromeos/ime/input_method_manager.h" 69 #include "chromeos/ime/input_method_manager.h"
72 #include "chromeos/login/user_names.h" 70 #include "chromeos/login/user_names.h"
73 #include "chromeos/network/portal_detector/network_portal_detector.h" 71 #include "chromeos/network/portal_detector/network_portal_detector.h"
74 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" 72 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h"
75 #include "chromeos/settings/cros_settings_names.h" 73 #include "chromeos/settings/cros_settings_names.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 const base::FilePath::CharType kRLZDisabledFlagName[] = 171 const base::FilePath::CharType kRLZDisabledFlagName[] =
174 FILE_PATH_LITERAL(".rlz_disabled"); 172 FILE_PATH_LITERAL(".rlz_disabled");
175 173
176 base::FilePath GetRlzDisabledFlagPath() { 174 base::FilePath GetRlzDisabledFlagPath() {
177 base::FilePath homedir; 175 base::FilePath homedir;
178 PathService::Get(base::DIR_HOME, &homedir); 176 PathService::Get(base::DIR_HOME, &homedir);
179 return homedir.Append(kRLZDisabledFlagName); 177 return homedir.Append(kRLZDisabledFlagName);
180 } 178 }
181 #endif 179 #endif
182 180
183 // Callback to GetNSSCertDatabaseForProfile. It starts CertLoader using the
184 // provided NSS database. It must be called for primary user only.
185 void OnGetNSSCertDatabaseForUser(net::NSSCertDatabase* database) {
186 if (!CertLoader::IsInitialized())
187 return;
188
189 CertLoader::Get()->StartWithNSSDB(database);
190 }
191
192 } // namespace 181 } // namespace
193 182
194 #if defined(ENABLE_RLZ) 183 #if defined(ENABLE_RLZ)
195 void UserSessionManagerDelegate::OnRlzInitialized() { 184 void UserSessionManagerDelegate::OnRlzInitialized() {
196 } 185 }
197 #endif 186 #endif
198 187
199 UserSessionManagerDelegate::~UserSessionManagerDelegate() { 188 UserSessionManagerDelegate::~UserSessionManagerDelegate() {
200 } 189 }
201 190
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 content::NotificationService::current()->Notify( 856 content::NotificationService::current()->Notify(
868 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 857 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
869 content::NotificationService::AllSources(), 858 content::NotificationService::AllSources(),
870 content::Details<Profile>(profile)); 859 content::Details<Profile>(profile));
871 860
872 // Initialize various services only for primary user. 861 // Initialize various services only for primary user.
873 const user_manager::User* user = 862 const user_manager::User* user =
874 ProfileHelper::Get()->GetUserByProfile(profile); 863 ProfileHelper::Get()->GetUserByProfile(profile);
875 if (user_manager->GetPrimaryUser() == user) { 864 if (user_manager->GetPrimaryUser() == user) {
876 InitRlz(profile); 865 InitRlz(profile);
877 InitializeCerts(profile);
878 InitializeCRLSetFetcher(user); 866 InitializeCRLSetFetcher(user);
879 } 867 }
880 868
881 UpdateEasyUnlockKeys(user_context_); 869 UpdateEasyUnlockKeys(user_context_);
882 user_context_.ClearSecrets(); 870 user_context_.ClearSecrets();
883 871
884 // Now that profile is ready, proceed to either alternative login flows or 872 // Now that profile is ready, proceed to either alternative login flows or
885 // launch browser. 873 // launch browser.
886 bool browser_launched = InitializeUserSession(profile); 874 bool browser_launched = InitializeUserSession(profile);
887 875
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 RLZTracker::InitRlzFromProfileDelayed( 1067 RLZTracker::InitRlzFromProfileDelayed(
1080 profile, 1068 profile,
1081 user_manager::UserManager::Get()->IsCurrentUserNew(), 1069 user_manager::UserManager::Get()->IsCurrentUserNew(),
1082 ping_delay < 0, 1070 ping_delay < 0,
1083 base::TimeDelta::FromMilliseconds(abs(ping_delay))); 1071 base::TimeDelta::FromMilliseconds(abs(ping_delay)));
1084 if (delegate_) 1072 if (delegate_)
1085 delegate_->OnRlzInitialized(); 1073 delegate_->OnRlzInitialized();
1086 #endif 1074 #endif
1087 } 1075 }
1088 1076
1089 void UserSessionManager::InitializeCerts(Profile* profile) {
1090 // Now that the user profile has been initialized
1091 // |GetNSSCertDatabaseForProfile| is safe to be used.
1092 if (CertLoader::IsInitialized() && base::SysInfo::IsRunningOnChromeOS()) {
1093 GetNSSCertDatabaseForProfile(profile,
1094 base::Bind(&OnGetNSSCertDatabaseForUser));
1095 }
1096 }
1097
1098 void UserSessionManager::InitializeCRLSetFetcher( 1077 void UserSessionManager::InitializeCRLSetFetcher(
1099 const user_manager::User* user) { 1078 const user_manager::User* user) {
1100 const std::string username_hash = user->username_hash(); 1079 const std::string username_hash = user->username_hash();
1101 if (!username_hash.empty()) { 1080 if (!username_hash.empty()) {
1102 base::FilePath path; 1081 base::FilePath path;
1103 path = ProfileHelper::GetProfilePathByUserIdHash(username_hash); 1082 path = ProfileHelper::GetProfilePathByUserIdHash(username_hash);
1104 component_updater::ComponentUpdateService* cus = 1083 component_updater::ComponentUpdateService* cus =
1105 g_browser_process->component_updater(); 1084 g_browser_process->component_updater();
1106 CRLSetFetcher* crl_set = g_browser_process->crl_set_fetcher(); 1085 CRLSetFetcher* crl_set = g_browser_process->crl_set_fetcher();
1107 if (crl_set && cus) 1086 if (crl_set && cus)
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 } 1260 }
1282 1261
1283 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { 1262 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() {
1284 if (!easy_unlock_key_manager_) 1263 if (!easy_unlock_key_manager_)
1285 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); 1264 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager);
1286 1265
1287 return easy_unlock_key_manager_.get(); 1266 return easy_unlock_key_manager_.get();
1288 } 1267 }
1289 1268
1290 } // namespace chromeos 1269 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698