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

Unified Diff: chrome/browser/chromeos/profiles/avatar_menu_chromeos.cc

Issue 197773004: Move avatar holder code to ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 6 years, 9 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
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/ui/ash/multi_user/multi_user_window_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/ui/ash/multi_user/multi_user_window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698