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

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

Issue 222313005: [Profiles] Download high-res avatars using the --new-profile-management flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: typo Created 6 years, 8 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_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..1777152ccf041b2ce43f41b2eaec1932cc35b898 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,15 @@ 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);
+ base::FilePath image_path = user_data_dir.AppendASCII(
+ kHighResAvatarFolderName).AppendASCII(file_name);
+ return image_path;
msw 2014/04/28 20:46:37 nit: inline the return value.
noms (inactive) 2014/04/29 19:12:27 Done.
+}
+
std::string GetDefaultAvatarIconUrl(size_t index) {
DCHECK(IsDefaultAvatarIconIndex(index));
return base::StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index);

Powered by Google App Engine
This is Rietveld 408576698