| Index: chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
|
| diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
|
| index bc52d45b3f8ba417b1386a8840d47f4d0d889bd0..5ae03550b082e8991c5d1ccb52b815b89da7c224 100644
|
| --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
|
| +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
|
| @@ -5,11 +5,15 @@
|
| #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
|
|
|
| #include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/managed_mode.h"
|
| +#include "chrome/browser/profiles/avatar_menu_model.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_info_cache.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/ui/views/avatar_menu_button.h"
|
| #include "chrome/browser/ui/views/frame/browser_view.h"
|
| +#include "grit/theme_resources.h"
|
| +#include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/image/image.h"
|
|
|
| BrowserNonClientFrameView::BrowserNonClientFrameView(BrowserFrame* frame,
|
| @@ -24,8 +28,9 @@ BrowserNonClientFrameView::~BrowserNonClientFrameView() {
|
| void BrowserNonClientFrameView::UpdateAvatarInfo() {
|
| if (browser_view_->ShouldShowAvatar()) {
|
| if (!avatar_button_.get()) {
|
| - avatar_button_.reset(new AvatarMenuButton(
|
| - browser_view_->browser(), !browser_view_->IsOffTheRecord()));
|
| + avatar_button_.reset(
|
| + new AvatarMenuButton(browser_view_->browser(),
|
| + browser_view_->IsOffTheRecord()));
|
| AddChildView(avatar_button_.get());
|
| frame_->GetRootView()->Layout();
|
| }
|
| @@ -35,39 +40,46 @@ void BrowserNonClientFrameView::UpdateAvatarInfo() {
|
| frame_->GetRootView()->Layout();
|
| }
|
|
|
| - // For popups and panels which don't have the avatar button, we still
|
| - // need to draw the taskbar decoration.
|
| - if (browser_view_->IsBrowserTypeNormal()) {
|
| - if (!avatar_button_.get())
|
| - return;
|
| - }
|
| -
|
| + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
| + gfx::Image avatar;
|
| + string16 text;
|
| + bool is_gaia_picture = false;
|
| if (browser_view_->IsGuestSession()) {
|
| - const gfx::Image avatar(new SkBitmap(browser_view_->GetGuestAvatarIcon()));
|
| - if (avatar_button_.get())
|
| - avatar_button_->SetAvatarIcon(avatar, false);
|
| - DrawTaskBarDecoration(frame_->GetNativeWindow(), &avatar);
|
| +#if defined(OS_CHROMEOS)
|
| + avatar = rb.GetImageNamed(IDR_GUEST_ICON);
|
| +#else
|
| + NOTREACHED();
|
| +#endif
|
| } else if (browser_view_->IsOffTheRecord()) {
|
| - const gfx::Image avatar(new SkBitmap(browser_view_->GetOTRAvatarIcon()));
|
| - if (avatar_button_.get())
|
| - avatar_button_->SetAvatarIcon(avatar, false);
|
| - DrawTaskBarDecoration(frame_->GetNativeWindow(), &avatar);
|
| - } else {
|
| + avatar = rb.GetImageNamed(IDR_OTR_ICON);
|
| + } else if (ManagedMode::IsInManagedMode()) {
|
| + avatar = rb.GetImageNamed(IDR_MANAGED_MODE_AVATAR);
|
| + } else if (AvatarMenuModel::ShouldShowAvatarMenu()) {
|
| ProfileInfoCache& cache =
|
| g_browser_process->profile_manager()->GetProfileInfoCache();
|
| Profile* profile = browser_view_->browser()->profile();
|
| size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
|
| - if (index != std::string::npos) {
|
| - bool is_gaia_picture =
|
| - cache.IsUsingGAIAPictureOfProfileAtIndex(index) &&
|
| - cache.GetGAIAPictureOfProfileAtIndex(index);
|
| - const gfx::Image& avatar = cache.GetAvatarIconOfProfileAtIndex(index);
|
| - if (avatar_button_.get()) {
|
| - avatar_button_->SetAvatarIcon(avatar, is_gaia_picture);
|
| - avatar_button_->SetText(cache.GetNameOfProfileAtIndex(index));
|
| - }
|
| - DrawTaskBarDecoration(frame_->GetNativeWindow(), &avatar);
|
| - }
|
| + if (index == std::string::npos)
|
| + return;
|
| + is_gaia_picture =
|
| + cache.IsUsingGAIAPictureOfProfileAtIndex(index) &&
|
| + cache.GetGAIAPictureOfProfileAtIndex(index);
|
| + avatar = cache.GetAvatarIconOfProfileAtIndex(index);
|
| + text = cache.GetNameOfProfileAtIndex(index);
|
| + }
|
| + if (avatar_button_.get()) {
|
| + avatar_button_->SetAvatarIcon(avatar, is_gaia_picture);
|
| + if (!text.empty())
|
| + avatar_button_->SetText(text);
|
| + }
|
| +
|
| + // For popups and panels which don't have the avatar button, we still
|
| + // need to draw the taskbar decoration.
|
| + if (AvatarMenuModel::ShouldShowAvatarMenu() ||
|
| + ManagedMode::IsInManagedMode()) {
|
| + DrawTaskBarDecoration(frame_->GetNativeWindow(), &avatar);
|
| + } else {
|
| + DrawTaskBarDecoration(frame_->GetNativeWindow(), NULL);
|
| }
|
| }
|
|
|
|
|