Commit a34e8536 authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

Add public method GetGuestAvatar()

... to provide the same guest avatar in all
surfaces.

Bug: 966388
Change-Id: Id69cb896cef6d520a635afbc66019cc0fe6c9b61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826889Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Auto-Submit: Thomas Tangl <tangltom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701050}
parent 969ad754
......@@ -19,6 +19,7 @@
#include "base/values.h"
#include "build/build_config.h"
#include "cc/paint/paint_flags.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/grit/generated_resources.h"
......@@ -30,10 +31,12 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/image/canvas_image_source.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/skia_util.h"
#include "url/url_canon.h"
......@@ -329,6 +332,11 @@ constexpr size_t kPlaceholderAvatarIndex = 26;
constexpr size_t kPlaceholderAvatarIndex = 0;
#endif
gfx::ImageSkia GetGuestAvatar(int size) {
return gfx::CreateVectorIcon(kUserAccountAvatarIcon, size,
gfx::kGoogleGrey500);
}
gfx::Image GetSizedAvatarIcon(const gfx::Image& image,
bool is_rectangle,
int width,
......
......@@ -13,6 +13,7 @@
#include "build/build_config.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/image/image_skia.h"
namespace base {
class FilePath;
......@@ -55,6 +56,9 @@ enum AvatarShape {
SHAPE_SQUARE,
};
// Returns the default guest avatar.
gfx::ImageSkia GetGuestAvatar(int size = 256);
// Returns a version of |image| of a specific size. Note that no checks are
// done on the width/height so make sure they're reasonable values; in the
// range of 16-256 is probably best.
......
......@@ -433,7 +433,7 @@ void ProfileMenuView::BuildIdentity() {
}
void ProfileMenuView::BuildGuestIdentity() {
SetIdentityInfo(ImageForMenu(kUserAccountAvatarIcon), GetIdentityBadge(),
SetIdentityInfo(profiles::GetGuestAvatar(), GetIdentityBadge(),
l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME));
}
......@@ -618,7 +618,7 @@ void ProfileMenuView::BuildProfileFeatureButtons() {
base::Unretained(this)));
AddProfileFeatureButton(
ColoredImageForMenu(kUserAccountAvatarIcon, gfx::kGoogleGrey500),
profiles::GetGuestAvatar(),
l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME),
base::BindRepeating(&ProfileMenuView::OnGuestProfileButtonClicked,
base::Unretained(this)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment