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

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

Issue 2066093003: Refactor fetching profile avatar icons and labels repeated md-settings & md-user-manager (C++) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@avatar-selector-refactor
Patch Set: Created 4 years, 6 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 2d82b35a684ce27f9220bf0795ba8455ffd41856..52a0d26af61124a611c426476bff672aa2ab6716 100644
--- a/chrome/browser/profiles/profile_avatar_icon_util.cc
+++ b/chrome/browser/profiles/profile_avatar_icon_util.cc
@@ -23,6 +23,7 @@
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkScalar.h"
#include "third_party/skia/include/core/SkXfermode.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
@@ -493,4 +494,25 @@ bool GetImageURLWithThumbnailSize(
return true;
}
+std::unique_ptr<base::ListValue> GetDefaultProfileAvatarIconsAndLabels() {
+ std::unique_ptr<base::ListValue> avatars(new base::ListValue());
+
+ // Add the default avatar icons and labels.
tommycli 2016/06/15 21:22:44 nit: Can axe this comment since it's now within th
Moe 2016/06/16 13:36:46 Done.
+ size_t placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex();
+ for (size_t i = 0; i < profiles::GetDefaultAvatarIconCount() &&
tommycli 2016/06/15 21:22:44 Is this the preferred formatting from 'git cl form
Moe 2016/06/16 13:36:46 yep. It doesn't complain.
+ i != placeholder_avatar_index;
+ i++) {
+ std::unique_ptr<base::DictionaryValue> avatar_info(
+ new base::DictionaryValue());
+ avatar_info->SetString("url", profiles::GetDefaultAvatarIconUrl(i));
+ avatar_info->SetString(
+ "label",
+ l10n_util::GetStringUTF16(
+ profiles::GetDefaultAvatarLabelResourceIDAtIndex(i)));
+
+ avatars->Append(std::move(avatar_info));
+ }
+ return avatars;
+}
+
} // namespace profiles

Powered by Google App Engine
This is Rietveld 408576698