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

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 review comments 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..8f50cb4803dcecdd811952e7442b25525487af19 100644
--- a/chrome/browser/android/profiles/profile_downloader_android.cc
+++ b/chrome/browser/android/profiles/profile_downloader_android.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile_downloader.h"
#include "chrome/browser/profiles/profile_downloader_delegate.h"
#include "chrome/browser/profiles/profile_manager.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 +26,11 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
public:
explicit AccountInfoRetriever(Profile* profile,
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 +63,7 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
virtual void OnProfileDownloadSuccess(
ProfileDownloader* downloader) OVERRIDE {
ProfileDownloaderAndroid::OnProfileDownloadSuccess(
- account_id_,
+ email_,
downloader->GetProfileFullName(),
downloader->GetProfilePicture());
Shutdown();
@@ -79,8 +82,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 +154,16 @@ 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.
AccountInfoRetriever* retriever =
- new AccountInfoRetriever(profile, account_id, image_side_pixels);
+ new AccountInfoRetriever(profile, gaia::CanonicalizeEmail(email), email,
+ image_side_pixels);
guohui 2014/10/07 04:06:03 it may be better to add a DCHECK for AccountTracke
Roger Tawa OOO till Jul 10th 2014/10/07 21:38:30 Done.
retriever->Start();
}

Powered by Google App Engine
This is Rietveld 408576698