| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/avatar_menu_button.h" | 5 #include "chrome/browser/ui/views/avatar_menu_button.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" | 8 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
| 9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 10 #include "ui/gfx/canvas_skia.h" | 10 #include "ui/gfx/canvas_skia.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 152 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
| 153 gfx::Point origin; | 153 gfx::Point origin; |
| 154 views::View::ConvertPointToScreen(this, &origin); | 154 views::View::ConvertPointToScreen(this, &origin); |
| 155 gfx::Rect bounds(0, 0, width(), height()); | 155 gfx::Rect bounds(0, 0, width(), height()); |
| 156 bounds.set_origin(origin); | 156 bounds.set_origin(origin); |
| 157 | 157 |
| 158 AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_); | 158 AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_); |
| 159 // Bubble::Show() takes ownership of the view. | 159 // Bubble::Show() takes ownership of the view. |
| 160 bubble_ = Bubble::Show(browser_view->GetWidget(), bounds, | 160 bubble_ = Bubble::Show(browser_view->GetWidget(), bounds, |
| 161 views::BubbleBorder::TOP_LEFT, bubble_view, bubble_view); | 161 views::BubbleBorder::TOP_LEFT, |
| 162 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bubble_view, bubble_view); |
| 162 bubble_->AddObserver(this); | 163 bubble_->AddObserver(this); |
| 163 } | 164 } |
| 164 | 165 |
| 165 void AvatarMenuButton::OnBubbleClosing() { | 166 void AvatarMenuButton::OnBubbleClosing() { |
| 166 bubble_->RemoveObserver(this); | 167 bubble_->RemoveObserver(this); |
| 167 bubble_ = NULL; | 168 bubble_ = NULL; |
| 168 } | 169 } |
| OLD | NEW |