Index: chrome/browser/profiles/profile_info_util.cc |
diff --git a/chrome/browser/profiles/profile_info_util.cc b/chrome/browser/profiles/profile_info_util.cc |
index 9956d0e184c82a193aaf729000f73db2305db221..6a557b45c652f708dd7cabb51f1f220d4a00504c 100644 |
--- a/chrome/browser/profiles/profile_info_util.cc |
+++ b/chrome/browser/profiles/profile_info_util.cc |
@@ -35,6 +35,24 @@ gfx::Image GetAvatarIconForMenu(const gfx::Image& image, |
return gfx::Image(new SkBitmap(canvas.ExtractBitmap())); |
} |
+gfx::Image GetAvatarIconForWebUI(const gfx::Image& image, |
+ bool is_gaia_picture) { |
+ if (!is_gaia_picture) |
+ return image; |
+ |
+ int length = std::min(kAvatarIconWidth, kAvatarIconHeight) - 2; |
+ SkBitmap bmp = skia::ImageOperations::Resize( |
+ image, skia::ImageOperations::RESIZE_BEST, length, length); |
+ gfx::CanvasSkia canvas(kAvatarIconWidth, kAvatarIconHeight, false); |
+ |
+ // Draw the icon centered on the canvas. |
+ int x = (kAvatarIconWidth - length) / 2; |
+ int y = (kAvatarIconHeight - length) / 2; |
+ canvas.DrawBitmapInt(bmp, x, y); |
+ |
+ return gfx::Image(new SkBitmap(canvas.ExtractBitmap())); |
+} |
+ |
gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image, |
bool is_gaia_picture, |
int dst_width, |