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

Unified Diff: components/signin/core/browser/account_tracker_service.cc

Issue 1091363002: Change ProfileDownloader to use AccountTrackerService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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: components/signin/core/browser/account_tracker_service.cc
diff --git a/components/signin/core/browser/account_tracker_service.cc b/components/signin/core/browser/account_tracker_service.cc
index 1191a96651ed11dc9078dce7aa27685e47bdf81a..f41aad0f01776c6408c1cbfa06467cd79a5f368b 100644
--- a/components/signin/core/browser/account_tracker_service.cc
+++ b/components/signin/core/browser/account_tracker_service.cc
@@ -31,6 +31,7 @@ const char kAccountHostedDomainPath[] = "hd";
const char kAccountFullNamePath[] = "full_name";
const char kAccountGivenNamePath[] = "given_name";
const char kAccountLocalePath[] = "locale";
+const char kAccountPictureURLPath[] = "picture_url";
#if !defined(OS_ANDROID) && !defined(OS_IOS)
// IsRefreshTokenDeviceIdExperimentEnabled is called from
@@ -169,10 +170,10 @@ void AccountInfoFetcher::OnNetworkError(int response_code) {
AccountTrackerService::AccountInfo::AccountInfo() {}
AccountTrackerService::AccountInfo::~AccountInfo() {}
-bool AccountTrackerService::AccountInfo::IsValid() {
+bool AccountTrackerService::AccountInfo::IsValid() const {
return !account_id.empty() && !email.empty() && !gaia.empty() &&
!hosted_domain.empty() && !full_name.empty() && !given_name.empty() &&
- !locale.empty();
+ !locale.empty() && !picture_url.empty();
}
@@ -427,6 +428,7 @@ void AccountTrackerService::SetAccountStateFromUserInfo(
user_info->GetString("name", &state.info.full_name);
user_info->GetString("given_name", &state.info.given_name);
user_info->GetString("locale", &state.info.locale);
+ user_info->GetString("picture", &state.info.picture_url);
NotifyAccountUpdated(state);
SaveToPrefs(state);
@@ -484,6 +486,8 @@ void AccountTrackerService::LoadFromPrefs() {
state.info.given_name = base::UTF16ToUTF8(value);
if (dict->GetString(kAccountLocalePath, &value))
state.info.locale = base::UTF16ToUTF8(value);
+ if (dict->GetString(kAccountPictureURLPath, &value))
Mike Lerman 2015/04/20 13:25:23 Roger: Does every account HAVE a picture? What if
Roger Tawa OOO till Jul 10th 2015/04/21 14:00:34 That's a good question, don't have the answer. If
anthonyvd 2015/04/29 15:15:08 Done.
+ state.info.picture_url = base::UTF16ToUTF8(value);
if (state.info.IsValid())
NotifyAccountUpdated(state);
}
@@ -518,6 +522,7 @@ void AccountTrackerService::SaveToPrefs(const AccountState& state) {
dict->SetString(kAccountFullNamePath, state.info.full_name);
dict->SetString(kAccountGivenNamePath, state.info.given_name);
dict->SetString(kAccountLocalePath, state.info.locale);
+ dict->SetString(kAccountPictureURLPath, state.info.picture_url);
}
void AccountTrackerService::RemoveFromPrefs(const AccountState& state) {

Powered by Google App Engine
This is Rietveld 408576698