| 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/profile_menu_model.h" | 8 #include "chrome/browser/ui/profile_menu_model.h" |
| 9 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" | 9 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void AvatarMenuButton::SetIcon(const SkBitmap& icon) { | 124 void AvatarMenuButton::SetIcon(const SkBitmap& icon) { |
| 125 views::MenuButton::SetIcon(icon); | 125 views::MenuButton::SetIcon(icon); |
| 126 set_taskbar_decoration_ = true; | 126 set_taskbar_decoration_ = true; |
| 127 } | 127 } |
| 128 | 128 |
| 129 // views::ViewMenuDelegate implementation | 129 // views::ViewMenuDelegate implementation |
| 130 void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | 130 void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { |
| 131 if (!has_menu_) | 131 if (!has_menu_) |
| 132 return; | 132 return; |
| 133 | 133 |
| 134 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( | 134 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
| 135 browser_->window()->GetNativeHandle()); | |
| 136 | |
| 137 gfx::Point origin; | 135 gfx::Point origin; |
| 138 views::View::ConvertPointToScreen(this, &origin); | 136 views::View::ConvertPointToScreen(this, &origin); |
| 139 gfx::Rect bounds(0, 0, width(), height()); | 137 gfx::Rect bounds(0, 0, width(), height()); |
| 140 bounds.set_origin(origin); | 138 bounds.set_origin(origin); |
| 141 | 139 |
| 142 AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_); | 140 AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_); |
| 143 // Bubble::Show() takes ownership of the view. | 141 // Bubble::Show() takes ownership of the view. |
| 144 Bubble::Show(browser_view->GetWidget(), bounds, | 142 Bubble::Show(browser_view->GetWidget(), bounds, |
| 145 views::BubbleBorder::TOP_LEFT, | 143 views::BubbleBorder::TOP_LEFT, |
| 146 bubble_view, bubble_view); | 144 bubble_view, bubble_view); |
| 147 } | 145 } |
| OLD | NEW |