Index: chrome/browser/chromeos/profiles/avatar_menu_chromeos.cc |
diff --git a/chrome/browser/chromeos/profiles/avatar_menu_chromeos.cc b/chrome/browser/chromeos/profiles/avatar_menu_chromeos.cc |
index 3b196ec2803d7d12ac662afd7e87e205377a4fd4..7b1ff3096bbe6ae517134e4f2c66aad51eaf1c62 100644 |
--- a/chrome/browser/chromeos/profiles/avatar_menu_chromeos.cc |
+++ b/chrome/browser/chromeos/profiles/avatar_menu_chromeos.cc |
@@ -6,45 +6,15 @@ |
#include <string> |
-#include "chrome/browser/chromeos/login/user_manager.h" |
-#include "chrome/browser/chromeos/profiles/profile_helper.h" |
-#include "chrome/browser/profiles/profile_manager.h" |
-#include "grit/theme_resources.h" |
-#include "ui/base/resource/resource_bundle.h" |
-#include "ui/gfx/image/image_skia_operations.h" |
+#include "ash/frame/frame_util.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "ui/gfx/image/image.h" |
// static |
void AvatarMenu::GetImageForMenuButton(Profile* profile, |
gfx::Image* image, |
bool* is_rectangle) { |
- 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); |
// ChromeOS avatar icon is circular. |
*is_rectangle = false; |
- |
- // Find the user for this profile. |
- std::string user_id_hash = |
- chromeos::ProfileHelper::GetUserIdHashFromProfile(profile); |
- chromeos::UserList users = chromeos::UserManager::Get()->GetLoggedInUsers(); |
- |
- for (chromeos::UserList::const_iterator it = users.begin(); |
- it != users.end(); ++it) { |
- if ((*it)->username_hash() == user_id_hash) { |
- gfx::ImageSkia avatar = (*it)->image(); |
- gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage( |
- avatar, skia::ImageOperations::RESIZE_BEST, holder->size()); |
- gfx::ImageSkia masked = |
- gfx::ImageSkiaOperations::CreateMaskedImage(resized, *holder_mask); |
- gfx::ImageSkia result = |
- gfx::ImageSkiaOperations::CreateSuperimposedImage(*holder, masked); |
- *image = gfx::Image(result); |
- return; |
- } |
- LOG(FATAL) << "avatar image for the profile '" |
- << profile->GetProfileName() << "' not found"; |
- } |
+ *image = ash::GetAvatarImageForContext(profile); |
} |