| Index: chrome/browser/profiles/profile_avatar_icon_util.cc
|
| diff --git a/chrome/browser/profiles/profile_avatar_icon_util.cc b/chrome/browser/profiles/profile_avatar_icon_util.cc
|
| index 192a0b762203695488a0b346651fddfb45de08fb..13241943d9bc1dd0700c4d7a01b7c4addf65529e 100644
|
| --- a/chrome/browser/profiles/profile_avatar_icon_util.cc
|
| +++ b/chrome/browser/profiles/profile_avatar_icon_util.cc
|
| @@ -4,10 +4,13 @@
|
|
|
| #include "chrome/browser/profiles/profile_avatar_icon_util.h"
|
|
|
| +#include "base/file_util.h"
|
| #include "base/format_macros.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/path_service.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/stringprintf.h"
|
| +#include "chrome/common/chrome_paths.h"
|
| #include "grit/generated_resources.h"
|
| #include "grit/theme_resources.h"
|
| #include "third_party/skia/include/core/SkPaint.h"
|
| @@ -17,6 +20,7 @@
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/canvas.h"
|
| #include "ui/gfx/image/canvas_image_source.h"
|
| +#include "ui/gfx/image/image.h"
|
| #include "ui/gfx/image/image_skia_operations.h"
|
|
|
| // Helper methods for transforming and drawing avatar icons.
|
| @@ -25,7 +29,6 @@ namespace {
|
| // Determine what the scaled height of the avatar icon should be for a
|
| // specified width, to preserve the aspect ratio.
|
| int GetScaledAvatarHeightForWidth(int width, const gfx::ImageSkia& avatar) {
|
| -
|
| // Multiply the width by the inverted aspect ratio (height over
|
| // width), and then add 0.5 to ensure the int truncation rounds nicely.
|
| int scaled_height = width *
|
| @@ -328,6 +331,14 @@ const char* GetNoHighResAvatarFileName() {
|
| return kNoHighResAvatar;
|
| }
|
|
|
| +base::FilePath GetPathOfHighResAvatarAtIndex(size_t index) {
|
| + std::string file_name = GetDefaultAvatarIconResourceInfo(index)->filename;
|
| + base::FilePath user_data_dir;
|
| + PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
|
| + return user_data_dir.AppendASCII(
|
| + kHighResAvatarFolderName).AppendASCII(file_name);
|
| +}
|
| +
|
| std::string GetDefaultAvatarIconUrl(size_t index) {
|
| DCHECK(IsDefaultAvatarIconIndex(index));
|
| return base::StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index);
|
| @@ -337,8 +348,7 @@ bool IsDefaultAvatarIconIndex(size_t index) {
|
| return index < kDefaultAvatarIconsCount;
|
| }
|
|
|
| -bool IsDefaultAvatarIconUrl(const std::string& url,
|
| - size_t* icon_index) {
|
| +bool IsDefaultAvatarIconUrl(const std::string& url, size_t* icon_index) {
|
| DCHECK(icon_index);
|
| if (url.find(kDefaultUrlPrefix) != 0)
|
| return false;
|
|
|