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

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

Issue 232743004: [Mirror Android] Do not return "old style" avatar icons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 773facb3cdc42040b8a712507748620ae17ea90e..0ec319952ffc16825d5df877a1dcc725111c3bbc 100644
--- a/chrome/browser/android/profiles/profile_downloader_android.cc
+++ b/chrome/browser/android/profiles/profile_downloader_android.cc
@@ -8,6 +8,7 @@
#include "base/android/jni_string.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_android.h"
+#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_downloader.h"
#include "chrome/browser/profiles/profile_downloader_delegate.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -135,9 +136,13 @@ jobject GetCachedAvatarForPrimaryAccount(JNIEnv* env,
ScopedJavaLocalRef<jobject> jbitmap;
if (index != std::string::npos) {
- const gfx::Image& img = info.GetAvatarIconOfProfileAtIndex(index);
- if (!img.IsEmpty() && img.AsImageSkia().bitmap())
- jbitmap = gfx::ConvertToJavaBitmap(img.AsImageSkia().bitmap());
+ gfx::Image avatar_image = info.GetAvatarIconOfProfileAtIndex(index);
+ if (!avatar_image.IsEmpty() &&
+ avatar_image.Width() > profiles::kAvatarIconWidth &&
+ avatar_image.Height() > profiles::kAvatarIconHeight &&
+ avatar_image.AsImageSkia().bitmap()) {
+ jbitmap = gfx::ConvertToJavaBitmap(avatar_image.AsImageSkia().bitmap());
+ }
}
return jbitmap.Release();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698