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

Unified Diff: chrome/browser/profiles/profile_window.cc

Issue 1117453002: Add gaia_id to ProfileInfoCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments Created 5 years, 7 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/profiles/profile_window.cc
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc
index 1da2c98fa312944e1a93201d3abbf0412fd37d16..73508b66e7ae79a536ea27becd25cbbe323b8c00 100644
--- a/chrome/browser/profiles/profile_window.cc
+++ b/chrome/browser/profiles/profile_window.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/account_reconcilor_factory.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
@@ -29,6 +30,7 @@
#include "chrome/common/url_constants.h"
#include "components/signin/core/browser/account_reconcilor.h"
#include "components/signin/core/browser/account_tracker_service.h"
+#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/user_metrics.h"
@@ -384,8 +386,6 @@ bool IsLockAvailable(Profile* profile) {
if (profile->IsGuestSession())
return false;
- const ProfileInfoCache& cache =
- g_browser_process->profile_manager()->GetProfileInfoCache();
std::string hosted_domain = profile->GetPrefs()->
GetString(prefs::kGoogleServicesHostedDomain);
// TODO(mlerman): After one release remove any hosted_domain reference to the
@@ -393,9 +393,9 @@ bool IsLockAvailable(Profile* profile) {
if (hosted_domain.empty()) {
AccountTrackerService* account_tracker =
AccountTrackerServiceFactory::GetForProfile(profile);
- int profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
- hosted_domain = account_tracker->FindAccountInfoByEmail(base::UTF16ToUTF8(
- cache.GetUserNameOfProfileAtIndex(profile_index))).hosted_domain;
+ std::string account_id =
+ SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedAccountId();
+ hosted_domain = account_tracker->GetAccountInfo(account_id).hosted_domain;
}
// TODO(mlerman): Prohibit only users who authenticate using SAML. Until then,
// prohibited users who use hosted domains (aside from google.com).
@@ -404,6 +404,8 @@ bool IsLockAvailable(Profile* profile) {
return false;
}
+ const ProfileInfoCache& cache =
+ g_browser_process->profile_manager()->GetProfileInfoCache();
for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
if (cache.ProfileIsSupervisedAtIndex(i))
return true;
« no previous file with comments | « chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc ('k') | chrome/browser/signin/chrome_signin_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698