summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-03 16:21:57 +0000
committerrhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-03 16:21:57 +0000
commit6556c953778fcd26f9b2ddd817be926cfd9ca191 (patch)
tree5c65566f1ca53fd08bda494147a4df7a65558b83
parenta326d4afc8ddee0050f616797b5bbed829dd9948 (diff)
downloadchromium_src-6556c953778fcd26f9b2ddd817be926cfd9ca191.zip
chromium_src-6556c953778fcd26f9b2ddd817be926cfd9ca191.tar.gz
chromium_src-6556c953778fcd26f9b2ddd817be926cfd9ca191.tar.bz2
Convert ProfileMenuButton menu implementation from Menu2 to MenuItemView.
BUG=chromium-os:13887 TEST=none Review URL: http://codereview.chromium.org/7027015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87792 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/profile_menu_button.cc14
-rw-r--r--chrome/browser/ui/views/profile_menu_button.h6
2 files changed, 11 insertions, 9 deletions
diff --git a/chrome/browser/ui/views/profile_menu_button.cc b/chrome/browser/ui/views/profile_menu_button.cc
index 64e8b4c..ae7a123 100644
--- a/chrome/browser/ui/views/profile_menu_button.cc
+++ b/chrome/browser/ui/views/profile_menu_button.cc
@@ -8,7 +8,9 @@
#include "ui/base/text/text_elider.h"
#include "ui/gfx/color_utils.h"
#include "views/controls/button/button.h"
-#include "views/controls/menu/menu_2.h"
+#include "views/controls/menu/menu_item_view.h"
+#include "views/controls/menu/menu_model_adapter.h"
+#include "views/window/window.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.
@@ -37,7 +39,6 @@ ProfileMenuButton::ProfileMenuButton(const std::wstring& text, Profile* profile)
SetHighlightColor(kTextHighlighted);
profile_menu_model_.reset(new ProfileMenuModel);
- menu_.reset(new views::Menu2(profile_menu_model_.get()));
}
ProfileMenuButton::~ProfileMenuButton() {}
@@ -49,6 +50,13 @@ void ProfileMenuButton::SetText(const std::wstring& text) {
// views::ViewMenuDelegate implementation
void ProfileMenuButton::RunMenu(views::View* source, const gfx::Point &pt) {
+ views::MenuModelAdapter menu_model_adapter(profile_menu_model_.get());
+ views::MenuItemView menu(&menu_model_adapter);
+ menu_model_adapter.BuildMenu(&menu);
+
gfx::Point menu_point(pt.x(), pt.y() + kMenuDisplayOffset);
- menu_->RunMenuAt(menu_point, views::Menu2::ALIGN_TOPRIGHT);
+ menu.RunMenuAt(source->GetWindow()->GetNativeWindow(), NULL,
+ gfx::Rect(pt, gfx::Size(0, 0)),
+ views::MenuItemView::TOPRIGHT,
+ true);
}
diff --git a/chrome/browser/ui/views/profile_menu_button.h b/chrome/browser/ui/views/profile_menu_button.h
index 262a9a6..c1389b9 100644
--- a/chrome/browser/ui/views/profile_menu_button.h
+++ b/chrome/browser/ui/views/profile_menu_button.h
@@ -24,10 +24,6 @@ namespace ui {
class Accelerator;
}
-namespace views {
-class Menu2;
-}
-
// ProfileMenuButton
//
// Shows the button for the multiprofile menu with an image layered
@@ -57,11 +53,9 @@ class ProfileMenuButton : public views::MenuButton,
// Overridden from views::ViewMenuDelegate:
virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE;
- scoped_ptr<views::Menu2> menu_;
scoped_ptr<ProfileMenuModel> profile_menu_model_;
DISALLOW_COPY_AND_ASSIGN(ProfileMenuButton);
};
#endif // CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_BUTTON_H_
-