Index: chrome/browser/ui/ash/multi_user/multi_user_util.cc |
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_util.cc b/chrome/browser/ui/ash/multi_user/multi_user_util.cc |
index e3444a283a87777a34a52d193ab08d137f71e6b2..ce5f01bf81726b77435d074235d7d704ac4cdd4d 100644 |
--- a/chrome/browser/ui/ash/multi_user/multi_user_util.cc |
+++ b/chrome/browser/ui/ash/multi_user/multi_user_util.cc |
@@ -10,6 +10,7 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_manager.h" |
+#include "components/user_manager/user_id.h" |
#include "google_apis/gaia/gaia_auth_util.h" |
#if defined(OS_CHROMEOS) |
@@ -19,18 +20,18 @@ |
namespace multi_user_util { |
-std::string GetUserIDFromProfile(Profile* profile) { |
+user_manager::UserID GetUserIDFromProfile(Profile* profile) { |
return GetUserIDFromEmail( |
profile->GetOriginalProfile()->GetProfileUserName()); |
} |
-std::string GetUserIDFromEmail(const std::string& email) { |
+user_manager::UserID GetUserIDFromEmail(const std::string& email) { |
// |email| and profile name could be empty if not yet logged in or guest mode. |
- return email.empty() ? |
- email : gaia::CanonicalizeEmail(gaia::SanitizeEmail(email)); |
+ return user_manager::UserID::FromUserEmail(email.empty() ? |
+ email : gaia::CanonicalizeEmail(gaia::SanitizeEmail(email))); |
} |
-Profile* GetProfileFromUserID(const std::string& user_id) { |
+Profile* GetProfileFromUserID(const user_manager::UserID& user_id) { |
// Unit tests can end up here without a |g_browser_process|. |
if (!g_browser_process || !g_browser_process->profile_manager()) |
return NULL; |
@@ -53,7 +54,7 @@ Profile* GetProfileFromWindow(aura::Window* window) { |
// We might come here before the manager got created - or in a unit test. |
if (!manager) |
return NULL; |
- const std::string user_id = manager->GetUserPresentingWindow(window); |
+ const user_manager::UserID user_id = manager->GetUserPresentingWindow(window); |
return user_id.empty() ? NULL : |
multi_user_util::GetProfileFromUserID(user_id); |
#else |
@@ -64,7 +65,7 @@ Profile* GetProfileFromWindow(aura::Window* window) { |
bool IsProfileFromActiveUser(Profile* profile) { |
#if defined(OS_CHROMEOS) |
return GetUserIDFromProfile(profile) == |
- user_manager::UserManager::Get()->GetActiveUser()->email(); |
+ user_manager::UserManager::Get()->GetActiveUser()->GetUserID(); |
#else |
// In non Chrome OS configurations this will be always true since this only |
// makes sense in separate desktop mode. |
@@ -72,11 +73,11 @@ bool IsProfileFromActiveUser(Profile* profile) { |
#endif |
} |
-const std::string& GetCurrentUserId() { |
+const user_manager::UserID& GetCurrentUserId() { |
#if defined(OS_CHROMEOS) |
- return user_manager::UserManager::Get()->GetActiveUser()->email(); |
+ return user_manager::UserManager::Get()->GetActiveUser()->GetUserID(); |
#else |
- return base::EmptyString(); |
+ return user_manager::UserID(std::string(), std::string()); |
#endif |
} |