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

Unified Diff: chrome/browser/chromeos/profiles/profile_helper.cc

Issue 442043002: ProfileManager doesn't depend on "--login-profile" switch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased and comments addressed. Created 6 years, 4 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/profiles/profile_helper.cc
diff --git a/chrome/browser/chromeos/profiles/profile_helper.cc b/chrome/browser/chromeos/profiles/profile_helper.cc
index fc95ed630b36a840337477130656f7236123bec4..eaf00c160a7e2422588bdf83e2e24df24734bb34 100644
--- a/chrome/browser/chromeos/profiles/profile_helper.cc
+++ b/chrome/browser/chromeos/profiles/profile_helper.cc
@@ -23,6 +23,9 @@ namespace chromeos {
namespace {
+// As defined in /chromeos/dbus/cryptohome_client.cc.
+static const char kUserIdHashSuffix[] = "-hash";
+
bool ShouldAddProfileDirPrefix(const std::string& user_id_hash) {
// Do not add profile dir prefix for legacy profile dir and test
// user profile. The reason of not adding prefix for test user profile
@@ -92,14 +95,6 @@ base::FilePath ProfileHelper::GetProfilePathByUserIdHash(
}
// static
-base::FilePath ProfileHelper::GetProfileDirByLegacyLoginProfileSwitch() {
- const std::string login_profile_value =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- chromeos::switches::kLoginProfile);
- return ProfileHelper::GetUserProfileDir(login_profile_value);
-}
-
-// static
base::FilePath ProfileHelper::GetSigninProfileDir() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
base::FilePath user_data_dir = profile_manager->user_data_dir();
@@ -138,31 +133,13 @@ std::string ProfileHelper::GetUserIdHashFromProfile(Profile* profile) {
// static
base::FilePath ProfileHelper::GetUserProfileDir(
const std::string& user_id_hash) {
- DCHECK(!user_id_hash.empty());
+ CHECK(!user_id_hash.empty());
return ShouldAddProfileDirPrefix(user_id_hash)
? base::FilePath(chrome::kProfileDirPrefix + user_id_hash)
: base::FilePath(user_id_hash);
}
// static
-base::FilePath ProfileHelper::GetUserProfileDirByUserId(
- const std::string& user_id) {
- // TODO(dpolukhin): Remove Chrome OS specific profile path logic from
- // ProfileManager and use only this function to construct profile path.
- // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233
- base::FilePath profile_dir;
- const user_manager::User* user =
- user_manager::UserManager::Get()->FindUser(user_id);
- if (user && !user->username_hash().empty())
- profile_dir = ProfileHelper::GetUserProfileDir(user->username_hash());
-
- ProfileManager* profile_manager = g_browser_process->profile_manager();
- profile_dir = profile_manager->user_data_dir().Append(profile_dir);
-
- return profile_dir;
-}
-
-// static
bool ProfileHelper::IsSigninProfile(Profile* profile) {
return profile->GetPath().BaseName().value() == chrome::kInitialProfile;
}
@@ -303,7 +280,9 @@ user_manager::User* ProfileHelper::GetUserByProfile(Profile* profile) {
user_manager::UserManager::Get()->GetPrimaryUser());
}
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ DCHECK(!content::BrowserThread::IsThreadInitialized(
+ content::BrowserThread::UI) ||
+ content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (ProfileHelper::IsSigninProfile(profile))
return NULL;
@@ -372,8 +351,6 @@ void ProfileHelper::OnSessionRestoreStateChanged(
void ProfileHelper::ActiveUserHashChanged(const std::string& hash) {
active_user_id_hash_ = hash;
- base::FilePath profile_path = GetProfilePathByUserIdHash(hash);
- VLOG(1) << "Switching to profile path: " << profile_path.value();
}
void ProfileHelper::SetProfileToUserMappingForTesting(
@@ -398,4 +375,9 @@ void ProfileHelper::SetUserToProfileMappingForTesting(
user_to_profile_for_testing_[user] = profile;
}
+std::string ProfileHelper::GetUserIdHashByUserIdForTests(
+ const std::string& user_id) const {
+ return user_id + kUserIdHashSuffix;
+}
+
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698