Chromium Code Reviews| 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..d0a8b4cf62fc84c1d8399b94c6a696dd2d659b13 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,18 @@ 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_); |
|
Ben Goodger (Google)
2011/11/21 20:23:22
4-space indent
msw
2011/11/21 20:39:01
Done.
|
| + views::BubbleDelegateView::CreateBubble(bubble); |
| + bubble->Show(); |
| ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
| } |
| - |
| -void AvatarMenuButton::OnBubbleClosing() { |
| - bubble_->RemoveObserver(this); |
| - bubble_ = NULL; |
| -} |