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

Unified Diff: chrome/browser/ui/views/profiles/avatar_menu_button.cc

Issue 1452923002: Vectorize MD otr frame icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dont crash in tests Created 5 years, 1 month 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/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 30da45d23be85c6e0c8b1015d2b29b688aecec06..522d128afbafceef6f30ed75840bfb0d6a0bd653 100644
--- a/chrome/browser/ui/views/profiles/avatar_menu_button.cc
+++ b/chrome/browser/ui/views/profiles/avatar_menu_button.cc
@@ -33,10 +33,10 @@ static inline int Round(double x) {
// static
const char AvatarMenuButton::kViewClassName[] = "AvatarMenuButton";
-AvatarMenuButton::AvatarMenuButton(Browser* browser, bool disabled)
+AvatarMenuButton::AvatarMenuButton(BrowserView* browser_view)
: MenuButton(NULL, base::string16(), this, false),
- browser_(browser),
- disabled_(disabled),
+ browser_view_(browser_view),
+ enabled_(browser_view_->IsRegularOrGuestSession()),
is_rectangle_(false),
old_height_(0),
button_on_right_(false) {
@@ -94,17 +94,17 @@ void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon,
}
// static
-bool AvatarMenuButton::GetAvatarImages(Profile* profile,
+bool AvatarMenuButton::GetAvatarImages(BrowserView* browser_view,
bool should_show_avatar_menu,
gfx::Image* avatar,
gfx::Image* taskbar_badge_avatar,
bool* is_rectangle) {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ const Profile* profile = browser_view->browser()->profile();
if (profile->GetProfileType() == Profile::GUEST_PROFILE) {
- *avatar = rb.
- GetImageNamed(profiles::GetPlaceholderAvatarIconResourceID());
+ *avatar = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
+ profiles::GetPlaceholderAvatarIconResourceID());
} else if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) {
- *avatar = rb.GetImageNamed(IDR_OTR_ICON);
+ *avatar = gfx::Image(browser_view->GetOTRAvatarIcon());
// TODO(nkostylev): Allow this on ChromeOS once the ChromeOS test
// environment handles profile directories correctly.
#if !defined(OS_CHROMEOS)
@@ -143,13 +143,13 @@ bool AvatarMenuButton::GetAvatarImages(Profile* profile,
bool AvatarMenuButton::DoesIntersectRect(const views::View* target,
const gfx::Rect& rect) const {
CHECK_EQ(target, this);
- return !disabled_ &&
+ return enabled_ &&
views::ViewTargeterDelegate::DoesIntersectRect(target, rect);
}
// views::MenuButtonListener implementation
void AvatarMenuButton::OnMenuButtonClicked(views::View* source,
const gfx::Point& point) {
- if (!disabled_)
- chrome::ShowAvatarMenu(browser_);
+ if (enabled_)
+ chrome::ShowAvatarMenu(browser_view_->browser());
}

Powered by Google App Engine
This is Rietveld 408576698