This source file includes following definitions.
- GetAvatarImageForContext
#include "ash/frame/frame_util.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "grit/ash_resources.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
namespace ash {
gfx::Image GetAvatarImageForContext(content::BrowserContext* context) {
static const gfx::ImageSkia* holder =
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_AVATAR_HOLDER);
static const gfx::ImageSkia* holder_mask =
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_AVATAR_HOLDER_MASK);
gfx::ImageSkia user_image =
Shell::GetInstance()->session_state_delegate()->GetUserImage(context);
gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage(
user_image, skia::ImageOperations::RESIZE_BEST, holder->size());
gfx::ImageSkia masked =
gfx::ImageSkiaOperations::CreateMaskedImage(resized, *holder_mask);
gfx::ImageSkia result =
gfx::ImageSkiaOperations::CreateSuperimposedImage(*holder, masked);
return gfx::Image(result);
}
}