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

Unified Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 417623002: user_manager component: Add UserManagerBase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: check for LocalState, update test - make sure that policies are initialized on UserManager creation Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/session/user_session_manager.cc
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc
index 43b795bd7de218cbc58d8a55795845ffce09bc26..7310bd3482d9e2406b63a1b94923d19d051eaa7a 100644
--- a/chrome/browser/chromeos/login/session/user_session_manager.cc
+++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
@@ -37,9 +37,11 @@
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
+#include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/google/google_brand_chromeos.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/net/crl_set_fetcher.h"
#include "chrome/browser/net/nss_context.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -316,12 +318,6 @@ void UserSessionManager::InitRlz(Profile* profile) {
#endif
}
-bool UserSessionManager::HasBrowserRestarted() const {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- return base::SysInfo::IsRunningOnChromeOS() &&
- command_line->HasSwitch(switches::kLoginUser);
-}
-
OAuth2LoginManager::SessionRestoreStrategy
UserSessionManager::GetSigninSessionRestoreStrategy() {
return session_restore_strategy_;
@@ -740,11 +736,10 @@ void UserSessionManager::FinalizePrepareProfile(Profile* profile) {
CryptohomeClient* client = DBusThreadManager::Get()->GetCryptohomeClient();
btl->AddLoginTimeMarker("TPMOwn-Start", false);
if (cryptohome_util::TpmIsEnabled() && !cryptohome_util::TpmIsBeingOwned()) {
- if (cryptohome_util::TpmIsOwned()) {
+ if (cryptohome_util::TpmIsOwned())
client->CallTpmClearStoredPasswordAndBlock();
- } else {
+ else
client->TpmCanAttemptOwnership(EmptyVoidDBusMethodCallback());
- }
}
btl->AddLoginTimeMarker("TPMOwn-End", false);
@@ -768,15 +763,16 @@ void UserSessionManager::FinalizePrepareProfile(Profile* profile) {
content::NotificationService::AllSources(),
content::Details<Profile>(profile));
- InitializeCertsForPrimaryUser(profile);
-
- // Initialize RLZ only for primary user.
+ // Initialize various services only for primary user.
const user_manager::User* user =
ProfileHelper::Get()->GetUserByProfile(profile);
- if (user_manager->GetPrimaryUser() == user)
+ if (user_manager->GetPrimaryUser() == user) {
InitRlz(profile);
+ InitializeCerts(profile);
+ InitializeCRLSetFetcher(user);
+ }
- // TODO(altimofeev): This pointer should probably never be NULL, but it looks
+ // TODO(nkostylev): This pointer should probably never be NULL, but it looks
// like LoginUtilsImpl::OnProfileCreated() may be getting called before
// UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is
// killed during shutdown in tests -- see http://crosbug.com/18269. Replace
@@ -878,21 +874,29 @@ void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
#endif
}
-void UserSessionManager::InitializeCertsForPrimaryUser(Profile* profile) {
+void UserSessionManager::InitializeCerts(Profile* profile) {
// Now that the user profile has been initialized
// |GetNSSCertDatabaseForProfile| is safe to be used.
- UserManager* user_manager = UserManager::Get();
- const user_manager::User* primary_user = user_manager->GetPrimaryUser();
- if (user_manager->IsUserLoggedIn() &&
- primary_user &&
- profile == ProfileHelper::Get()->GetProfileByUser(primary_user) &&
- CertLoader::IsInitialized() &&
- base::SysInfo::IsRunningOnChromeOS()) {
+ if (CertLoader::IsInitialized() && base::SysInfo::IsRunningOnChromeOS()) {
GetNSSCertDatabaseForProfile(profile,
base::Bind(&OnGetNSSCertDatabaseForUser));
}
}
+void UserSessionManager::InitializeCRLSetFetcher(
+ const user_manager::User* user) {
+ const std::string username_hash = user->username_hash();
+ if (!username_hash.empty()) {
+ base::FilePath path;
+ path = ProfileHelper::GetProfilePathByUserIdHash(username_hash);
+ component_updater::ComponentUpdateService* cus =
+ g_browser_process->component_updater();
+ CRLSetFetcher* crl_set = g_browser_process->crl_set_fetcher();
+ if (crl_set && cus)
+ crl_set->StartInitialLoad(cus, path);
+ }
+}
+
void UserSessionManager::OnRestoreActiveSessions(
const SessionManagerClient::ActiveSessionsMap& sessions,
bool success) {

Powered by Google App Engine
This is Rietveld 408576698