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

Unified Diff: chrome/browser/profiles/profile_info_util.cc

Issue 212603011: Newly created profiles should have the grey silhouette as avatar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo changes to (.png) image resources. Created 6 years, 9 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/profiles/profile_info_util.cc
diff --git a/chrome/browser/profiles/profile_info_util.cc b/chrome/browser/profiles/profile_info_util.cc
index 520c1d4b3b72e7825501b4a29141d217e071a1b9..48f9c72578c81500f087d802a80390b32a4efec7 100644
--- a/chrome/browser/profiles/profile_info_util.cc
+++ b/chrome/browser/profiles/profile_info_util.cc
@@ -171,38 +171,42 @@ void AvatarImageSource::Draw(gfx::Canvas* canvas) {
namespace profiles {
const int kAvatarIconWidth = 38;
-const int kAvatarIconHeight = 31;
+const int kAvatarIconHeight = 38;
const int kAvatarIconPadding = 2;
gfx::Image GetSizedAvatarIconWithBorder(const gfx::Image& image,
- bool is_rectangle,
+ bool is_gaia_image,
int width, int height) {
- if (!is_rectangle)
+ // The image requires no border or resizing.
+ if (!is_gaia_image && image.Height() <= height)
return image;
gfx::Size size(width, height);
- // Source for a centered, sized icon with a border.
+ // Source for a centered, sized icon.
+ // GAIA images get a border.
scoped_ptr<gfx::ImageSkiaSource> source(
new AvatarImageSource(
*image.ToImageSkia(),
size,
std::min(width, height),
AvatarImageSource::POSITION_CENTER,
- AvatarImageSource::BORDER_NORMAL));
+ is_gaia_image ? AvatarImageSource::BORDER_NORMAL :
+ AvatarImageSource::BORDER_NONE));
return gfx::Image(gfx::ImageSkia(source.release(), size));
}
gfx::Image GetAvatarIconForMenu(const gfx::Image& image,
- bool is_rectangle) {
+ bool is_gaia_image) {
return GetSizedAvatarIconWithBorder(
- image, is_rectangle, kAvatarIconWidth, kAvatarIconHeight);
+ image, is_gaia_image, kAvatarIconWidth, kAvatarIconHeight);
}
gfx::Image GetAvatarIconForWebUI(const gfx::Image& image,
- bool is_rectangle) {
- if (!is_rectangle)
+ bool is_gaia_image) {
+ // The image requires no border or resizing.
+ if (!is_gaia_image && image.Height() <= kAvatarIconHeight)
return image;
gfx::Size size(kAvatarIconWidth, kAvatarIconHeight);
@@ -220,10 +224,11 @@ gfx::Image GetAvatarIconForWebUI(const gfx::Image& image,
}
gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image,
- bool is_rectangle,
+ bool is_gaia_image,
int dst_width,
int dst_height) {
- if (!is_rectangle)
+ // The image requires no border or resizing.
+ if (!is_gaia_image && image.Height() <= kAvatarIconHeight)
return image;
int size = std::min(std::min(kAvatarIconWidth, kAvatarIconHeight),
@@ -231,14 +236,15 @@ gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image,
gfx::Size dst_size(dst_width, dst_height);
// Source for a sized icon drawn at the bottom center of the canvas,
- // with an etched border.
+ // with an etched border (for GAIA images).
scoped_ptr<gfx::ImageSkiaSource> source(
new AvatarImageSource(
*image.ToImageSkia(),
dst_size,
size,
AvatarImageSource::POSITION_BOTTOM_CENTER,
- AvatarImageSource::BORDER_ETCHED));
+ is_gaia_image ? AvatarImageSource::BORDER_ETCHED :
+ AvatarImageSource::BORDER_NONE));
return gfx::Image(gfx::ImageSkia(source.release(), dst_size));
}

Powered by Google App Engine
This is Rietveld 408576698