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

Unified Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 333353004: Fix the Windows 8 mode avatar button menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use another ProfileChooserView anchor, remove unused anchor_rect. Created 6 years, 6 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/browser/ui/browser_window.h ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/browser_view.cc
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index f91d36d5c80408db66d08044c9ddc329c0aaff44..e1f85ef7b306b1b583a98d888807ac64b1864b4a 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -2379,39 +2379,41 @@ void BrowserView::ShowAvatarBubble(WebContents* web_contents,
void BrowserView::ShowAvatarBubbleFromAvatarButton(
AvatarBubbleMode mode,
signin::GAIAServiceType service_type) {
+ views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT;
+ views::BubbleBorder::BubbleAlignment alignment =
+ views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR;
+ views::View* anchor_view = frame_->GetAvatarMenuButton();
+ if (!anchor_view)
+ anchor_view = toolbar_->app_menu();
+ else if (!frame_->GetAvatarMenuButton()->button_on_right())
+ arrow = views::BubbleBorder::TOP_LEFT;
+
if (switches::IsNewAvatarMenu()) {
NewAvatarButton* button = frame_->GetNewAvatarMenuButton();
if (button) {
- gfx::Point origin;
- views::View::ConvertPointToScreen(button, &origin);
- gfx::Rect bounds(origin, size());
-
- profiles::BubbleViewMode view_mode;
- switch (mode) {
- case AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT:
- view_mode = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT;
- break;
- case AVATAR_BUBBLE_MODE_SIGNIN:
- view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN;
- break;
- case AVATAR_BUBBLE_MODE_REAUTH:
- view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH;
- break;
- default:
- view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
- break;
- }
- ProfileChooserView::ShowBubble(
- view_mode, service_type, button, views::BubbleBorder::TOP_RIGHT,
- views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser());
+ anchor_view = button;
+ arrow = views::BubbleBorder::TOP_RIGHT;
+ alignment = views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE;
+ }
+
+ profiles::BubbleViewMode view_mode;
+ switch (mode) {
+ case AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT:
+ view_mode = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT;
+ break;
+ case AVATAR_BUBBLE_MODE_SIGNIN:
+ view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN;
+ break;
+ case AVATAR_BUBBLE_MODE_REAUTH:
+ view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH;
+ break;
+ default:
+ view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
+ break;
}
+ ProfileChooserView::ShowBubble(view_mode, service_type, anchor_view, arrow,
+ alignment, browser());
} else {
- views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT;
- views::View* anchor_view = frame_->GetAvatarMenuButton();
- if (!anchor_view)
- anchor_view = toolbar_->app_menu();
- else if (!frame_->GetAvatarMenuButton()->button_on_right())
- arrow = views::BubbleBorder::TOP_LEFT;
gfx::Point origin;
views::View::ConvertPointToScreen(anchor_view, &origin);
gfx::Rect bounds(origin, anchor_view->size());
@@ -2419,7 +2421,7 @@ void BrowserView::ShowAvatarBubbleFromAvatarButton(
ShouldHideUIForFullscreen() ? views::BubbleBorder::PAINT_TRANSPARENT :
views::BubbleBorder::PAINT_NORMAL;
AvatarMenuBubbleView::ShowBubble(anchor_view, arrow, arrow_paint_type,
- views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bounds, browser());
+ alignment, bounds, browser());
ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
}
}
« no previous file with comments | « chrome/browser/ui/browser_window.h ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698