| Index: chrome/browser/ui/views/profiles/avatar_menu_button.cc
|
| diff --git a/chrome/browser/ui/views/profiles/avatar_menu_button.cc b/chrome/browser/ui/views/profiles/avatar_menu_button.cc
|
| index 3c3deb168feda5f734ce75f89b72b057c58bf565..0cff2a4e54d292a498c17ab670a129354baa7802 100644
|
| --- a/chrome/browser/ui/views/profiles/avatar_menu_button.cc
|
| +++ b/chrome/browser/ui/views/profiles/avatar_menu_button.cc
|
| @@ -9,7 +9,10 @@
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/profiles/avatar_menu.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_avatar_icon_util.h"
|
| +#include "chrome/browser/profiles/profile_info_cache.h"
|
| +#include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/profiles/profile_metrics.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_commands.h"
|
| @@ -19,6 +22,8 @@
|
| #include "chrome/common/pref_names.h"
|
| #include "components/signin/core/common/profile_management_switches.h"
|
| #include "content/public/browser/notification_service.h"
|
| +#include "grit/theme_resources.h"
|
| +#include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/canvas.h"
|
| #include "ui/views/view_targeter.h"
|
| #include "ui/views/widget/widget.h"
|
| @@ -90,6 +95,41 @@ void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon,
|
| SchedulePaint();
|
| }
|
|
|
| +// static
|
| +void AvatarMenuButton::GetAvatarImages(Profile* profile,
|
| + gfx::Image* avatar,
|
| + gfx::Image* taskbar_badge_avatar,
|
| + bool *is_rectangle) {
|
| + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
| + if (profile->GetProfileType() == Profile::GUEST_PROFILE) {
|
| + *avatar = rb.
|
| + GetImageNamed(profiles::GetPlaceholderAvatarIconResourceID());
|
| + } else if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) {
|
| + *avatar = rb.GetImageNamed(IDR_OTR_ICON);
|
| + // TODO(nkostylev): Allow this on ChromeOS once the ChromeOS test
|
| + // environment handles profile directories correctly.
|
| +#if !defined(OS_CHROMEOS)
|
| + bool is_badge_rectangle = false;
|
| + // The taskbar badge should be the profile avatar, not the OTR avatar.
|
| + AvatarMenu::GetImageForMenuButton(profile,
|
| + taskbar_badge_avatar,
|
| + &is_badge_rectangle);
|
| +#endif
|
| + } else if (AvatarMenu::ShouldShowAvatarMenu()) {
|
| + ProfileInfoCache& cache =
|
| + g_browser_process->profile_manager()->GetProfileInfoCache();
|
| + size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
|
| + if (index == std::string::npos)
|
| + return;
|
| +
|
| + if (switches::IsNewAvatarMenu()) {
|
| + *avatar = cache.GetAvatarIconOfProfileAtIndex(index);
|
| + } else {
|
| + AvatarMenu::GetImageForMenuButton(profile, avatar, is_rectangle);
|
| + }
|
| + }
|
| +}
|
| +
|
| // views::ViewTargeterDelegate:
|
| bool AvatarMenuButton::DoesIntersectRect(const views::View* target,
|
| const gfx::Rect& rect) const {
|
|
|