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

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

Issue 7045023: Simplify ProfileMenuButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 7 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/views/profile_menu_button.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/profile_menu_button.cc
diff --git a/chrome/browser/ui/views/profile_menu_button.cc b/chrome/browser/ui/views/profile_menu_button.cc
index c7db54ef842c784cf5dfcc032ca501581bd4d622..cfc5928a539b23b1d7f2f54ed5da79ab94c932b3 100644
--- a/chrome/browser/ui/views/profile_menu_button.cc
+++ b/chrome/browser/ui/views/profile_menu_button.cc
@@ -10,7 +10,6 @@
#include "ui/gfx/color_utils.h"
#include "views/controls/button/button.h"
#include "views/controls/menu/menu_2.h"
-#include "views/controls/menu/view_menu_delegate.h"
// Menu should display below the profile button tag image on the frame. This
// offset size depends on whether the frame is in glass or opaque mode.
@@ -28,11 +27,8 @@ const int kProfileButtonBorderSpacing = 10;
// Maximum width for name string in pixels.
const int kMaxTextWidth = 200;
-ProfileMenuButton::ProfileMenuButton(views::ButtonListener* listener,
- const std::wstring& text,
- views::ViewMenuDelegate* menu_delegate,
- Profile* profile)
- : MenuButton(listener, text, menu_delegate, true) {
+ProfileMenuButton::ProfileMenuButton(const std::wstring& text, Profile* profile)
+ : MenuButton(NULL, text, this, true) {
// Turn off hover highlighting and position button in the center of the
// underlying profile tag image.
set_border(views::Border::CreateEmptyBorder(
@@ -52,12 +48,6 @@ void ProfileMenuButton::SetText(const std::wstring& text) {
font(), kMaxTextWidth, false)));
}
-void ProfileMenuButton::RunMenuAt(const gfx::Point& pt) {
- gfx::Point menu_point(pt.x(),
- pt.y() + kMenuDisplayOffset);
- menu_->RunMenuAt(menu_point, views::Menu2::ALIGN_TOPRIGHT);
-}
-
// ui::SimpleMenuModel::Delegate implementation
bool ProfileMenuButton::IsCommandIdChecked(int command_id) const {
return false;
@@ -82,3 +72,9 @@ void ProfileMenuButton::ExecuteCommand(int command_id) {
break;
}
}
+
+// views::ViewMenuDelegate implementation
+void ProfileMenuButton::RunMenu(views::View* source, const gfx::Point &pt) {
+ gfx::Point menu_point(pt.x(), pt.y() + kMenuDisplayOffset);
+ menu_->RunMenuAt(menu_point, views::Menu2::ALIGN_TOPRIGHT);
+}
« no previous file with comments | « chrome/browser/ui/views/profile_menu_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698