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

Unified Diff: chrome/browser/chromeos/login/user.cc

Issue 10454044: Added support for animated/nonanimated user image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Small fixes to comments. Created 8 years, 7 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/chromeos/login/user.cc
diff --git a/chrome/browser/chromeos/login/user.cc b/chrome/browser/chromeos/login/user.cc
index a0f4485a06c0f46bcd0e5532575b1b44d1e12a61..e6b65dd740b7f2f3f211f78daab18ee5f9bf74a4 100644
--- a/chrome/browser/chromeos/login/user.cc
+++ b/chrome/browser/chromeos/login/user.cc
@@ -30,7 +30,7 @@ std::string GetUserName(const std::string& email) {
User::User(const std::string& email, bool is_guest)
: email_(email),
- image_(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ user_image_(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
kDefaultImageResources[0])),
oauth_token_status_(OAUTH_TOKEN_STATUS_UNKNOWN),
image_index_(kInvalidImageIndex),
@@ -48,15 +48,15 @@ User::User(const std::string& email, bool is_guest)
User::~User() {}
-void User::SetImage(const gfx::ImageSkia& image, int image_index) {
- image_ = image;
+void User::SetImage(const UserImage& user_image, int image_index) {
+ user_image_ = user_image;
image_index_ = image_index;
image_is_stub_ = false;
}
void User::SetStubImage(int image_index) {
- image_ = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- kStubImageResourceID);
+ user_image_.SetImage(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ kStubImageResourceID));
image_index_ = image_index;
image_is_stub_ = true;
}
@@ -77,6 +77,14 @@ bool User::NeedsNameTooltip() const {
return !UserManager::Get()->IsDisplayNameUnique(GetDisplayName());
}
+bool User::GetAnimatedImage(UserImage::RawImage* raw_image) const {
+ if (raw_image && has_animated_image()) {
+ *raw_image = user_image_.raw_image();
+ return true;
+ }
+ return false;
+}
+
std::string User::GetNameTooltip() const {
const std::string& user_email = display_email_;
size_t at_pos = user_email.rfind('@');

Powered by Google App Engine
This is Rietveld 408576698