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

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

Issue 8500004: Rebase AvatarMenuBubbleView on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused var and fix init order (nits). Created 9 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
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_button.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/avatar_menu_button.cc
diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc
index a12c75925e7d6adefd011775ea476978e88d15f2..b69af2f0d2dd98299a687620faf527202c829d85 100644
--- a/chrome/browser/ui/views/avatar_menu_button.cc
+++ b/chrome/browser/ui/views/avatar_menu_button.cc
@@ -78,7 +78,6 @@ void DrawTaskBarDecoration(const Browser* browser, const SkBitmap* bitmap) {
AvatarMenuButton::AvatarMenuButton(Browser* browser, bool has_menu)
: MenuButton(NULL, string16(), this, false),
browser_(browser),
- bubble_(NULL),
has_menu_(has_menu),
set_taskbar_decoration_(false) {
// In RTL mode, the avatar icon should be looking the opposite direction.
@@ -86,8 +85,6 @@ AvatarMenuButton::AvatarMenuButton(Browser* browser, bool has_menu)
}
AvatarMenuButton::~AvatarMenuButton() {
- if (bubble_)
- OnBubbleClosing();
// During destruction of the browser frame, we might not have a window
// so the taskbar button will be removed by windows anyway.
if (browser_->IsAttemptingToCloseBrowser())
@@ -147,26 +144,17 @@ void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) {
}
void AvatarMenuButton::ShowAvatarBubble() {
- if (!has_menu_ || bubble_)
+ if (!has_menu_)
return;
- BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
gfx::Point origin;
views::View::ConvertPointToScreen(this, &origin);
- gfx::Rect bounds(0, 0, width(), height());
- bounds.set_origin(origin);
+ gfx::Rect bounds(origin, size());
- AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_);
- // Bubble::Show() takes ownership of the view.
- bubble_ = Bubble::Show(browser_view->GetWidget(), bounds,
- views::BubbleBorder::TOP_LEFT,
- views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bubble_view, bubble_view);
- bubble_->AddObserver(this);
+ AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this,
+ views::BubbleBorder::TOP_LEFT, bounds, browser_);
+ views::BubbleDelegateView::CreateBubble(bubble);
+ bubble->Show();
ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
}
-
-void AvatarMenuButton::OnBubbleClosing() {
- bubble_->RemoveObserver(this);
- bubble_ = NULL;
-}
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_button.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698