summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-09 21:30:46 +0000
committerrhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-09 21:30:46 +0000
commit2b20342b3e216a5e8b8280549c74f52b4b727fcf (patch)
tree91ff2bacdbc49392c797c26c8d1c171cdbec36b7 /chrome
parent0e935c56869b8da3d504410bc87794c7d3a16710 (diff)
downloadchromium_src-2b20342b3e216a5e8b8280549c74f52b4b727fcf.zip
chromium_src-2b20342b3e216a5e8b8280549c74f52b4b727fcf.tar.gz
chromium_src-2b20342b3e216a5e8b8280549c74f52b4b727fcf.tar.bz2
Convert BrowserActionOverflowMenu context menu from Menu2 to MenuItemView.
This is part of the GTK dependency removal. BUG=chromium-os:13887 TEST=none Review URL: http://codereview.chromium.org/7077033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88594 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc19
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h9
2 files changed, 12 insertions, 16 deletions
diff --git a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
index 23f2f6b..dbdf75e 100644
--- a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
@@ -13,8 +13,10 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
#include "ui/gfx/canvas_skia.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/controls/menu/submenu_view.h"
+#include "views/window/window.h"
BrowserActionOverflowMenuController::BrowserActionOverflowMenuController(
BrowserActionsContainer* owner,
@@ -96,13 +98,16 @@ bool BrowserActionOverflowMenuController::ShowContextMenu(
if (!extension->ShowConfigureContextMenus())
return false;
- context_menu_contents_ = new ExtensionContextMenuModel(
- extension,
- owner_->browser(),
- owner_);
- context_menu_menu_.reset(new views::Menu2(context_menu_contents_.get()));
+ scoped_refptr<ExtensionContextMenuModel> context_menu_contents =
+ new ExtensionContextMenuModel(extension, owner_->browser(), owner_);
+ views::MenuModelAdapter context_menu_model_adapter(
+ context_menu_contents.get());
+ views::MenuItemView context_menu(&context_menu_model_adapter);
+ context_menu_model_adapter.BuildMenu(&context_menu);
+
// This blocks until the user choses something or dismisses the menu.
- context_menu_menu_->RunContextMenuAt(p);
+ context_menu.RunMenuAt(menu_button_->GetWidget()->GetNativeWindow(),
+ NULL, gfx::Rect(p, gfx::Size()), views::MenuItemView::TOPLEFT, true);
// The user is done with the context menu, so we can close the underlying
// menu.
diff --git a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h
index cfade1f..79d69f9 100644
--- a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h
+++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h
@@ -15,11 +15,6 @@
class BrowserActionsContainer;
class BrowserActionView;
-class ExtensionContextMenuModel;
-
-namespace views {
-class Menu2;
-}
// This class handles the overflow menu for browser actions (showing the menu,
// drag and drop, etc). This class manages its own lifetime.
@@ -105,10 +100,6 @@ class BrowserActionOverflowMenuController : public views::MenuDelegate {
// Whether this controller is being used for drop.
bool for_drop_;
- // The browser action context menu and model.
- scoped_refptr<ExtensionContextMenuModel> context_menu_contents_;
- scoped_ptr<views::Menu2> context_menu_menu_;
-
friend class DeleteTask<BrowserActionOverflowMenuController>;
DISALLOW_COPY_AND_ASSIGN(BrowserActionOverflowMenuController);