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

Unified Diff: chrome/browser/android/profiles/profile_downloader_android.cc

Issue 617183003: Make sure GetAuthenticatedAccountId() returns a canonicalized id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Hui's comments, fix cvox tests Created 6 years, 2 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/android/profiles/profile_downloader_android.cc
diff --git a/chrome/browser/android/profiles/profile_downloader_android.cc b/chrome/browser/android/profiles/profile_downloader_android.cc
index c6d4785fd1cec985a05acbbe5377fe369b89feff..6579b6d1c7ba88ef0dc076a8658c141259c2781b 100644
--- a/chrome/browser/android/profiles/profile_downloader_android.cc
+++ b/chrome/browser/android/profiles/profile_downloader_android.cc
@@ -12,6 +12,9 @@
#include "chrome/browser/profiles/profile_downloader.h"
#include "chrome/browser/profiles/profile_downloader_delegate.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/signin/account_tracker_service_factory.h"
+#include "components/signin/core/browser/account_tracker_service.h"
+#include "google_apis/gaia/gaia_auth_util.h"
#include "jni/ProfileDownloader_jni.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/android/java_bitmap.h"
@@ -25,9 +28,11 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
public:
explicit AccountInfoRetriever(Profile* profile,
Joao da Silva 2014/10/08 13:19:17 explicit isnt required here
Roger Tawa OOO till Jul 10th 2014/10/08 19:47:29 Done.
const std::string& account_id,
+ const std::string& email,
const int desired_image_side_pixels)
: profile_(profile),
account_id_(account_id),
+ email_(email),
desired_image_side_pixels_(desired_image_side_pixels) {}
void Start() {
@@ -60,7 +65,7 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
virtual void OnProfileDownloadSuccess(
ProfileDownloader* downloader) OVERRIDE {
ProfileDownloaderAndroid::OnProfileDownloadSuccess(
- account_id_,
+ email_,
downloader->GetProfileFullName(),
downloader->GetProfilePicture());
Shutdown();
@@ -79,8 +84,9 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
// The browser profile associated with this download request.
Profile* profile_;
- // The account ID (email address) to be loaded.
+ // The account ID and email address of account to be loaded.
const std::string account_id_;
+ const std::string email_;
// Desired side length of the profile image (in pixels).
const int desired_image_side_pixels_;
@@ -150,13 +156,19 @@ void StartFetchingAccountInfoFor(
JNIEnv* env,
jclass clazz,
jobject jprofile,
- jstring jaccount_id,
+ jstring jemail,
jint image_side_pixels) {
Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
- const std::string account_id =
- base::android::ConvertJavaStringToUTF8(env, jaccount_id);
+ const std::string email =
+ base::android::ConvertJavaStringToUTF8(env, jemail);
+ // TODO(rogerta): the java code will need to pass in the gaia-id
+ // of the account instead of the email when chrome uses gaia-id as key.
+ DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED,
+ AccountTrackerServiceFactory::GetForProfile(profile)->
+ GetMigrationState());
AccountInfoRetriever* retriever =
- new AccountInfoRetriever(profile, account_id, image_side_pixels);
+ new AccountInfoRetriever(profile, gaia::CanonicalizeEmail(email), email,
Joao da Silva 2014/10/08 13:19:17 signin_manager_base.cc calls SanitizeEmail too, sh
Roger Tawa OOO till Jul 10th 2014/10/08 19:47:29 Good point. Done.
+ image_side_pixels);
retriever->Start();
}

Powered by Google App Engine
This is Rietveld 408576698