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

Unified Diff: views/controls/menu/native_menu_x.cc

Issue 7746012: Fixes the touch build from patch @ 98179 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | « views/controls/menu/native_menu_x.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/native_menu_x.cc
diff --git a/views/controls/menu/native_menu_x.cc b/views/controls/menu/native_menu_x.cc
index eb960422d0a9cf4ba07f2340c8b429948a75ca94..b07389e4a3ffb56f117a6db941e1a6d5dd10b335 100644
--- a/views/controls/menu/native_menu_x.cc
+++ b/views/controls/menu/native_menu_x.cc
@@ -9,13 +9,15 @@
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/skia_util.h"
#include "views/controls/menu/menu_2.h"
+#include "views/controls/menu/menu_runner.h"
#include "views/controls/menu/submenu_view.h"
namespace views {
NativeMenuX::NativeMenuX(Menu2* menu)
: model_(menu->model()),
- ALLOW_THIS_IN_INITIALIZER_LIST(root_(new MenuItemView(this))) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(root_(new MenuItemView(this))),
+ menu_runner_(new MenuRunner(root_)) {
}
NativeMenuX::~NativeMenuX() {
@@ -23,10 +25,13 @@ NativeMenuX::~NativeMenuX() {
// MenuWrapper implementation:
void NativeMenuX::RunMenuAt(const gfx::Point& point, int alignment) {
+ // TODO: this should really return the value from MenuRunner.
UpdateStates();
- root_->RunMenuAt(NULL, NULL, gfx::Rect(point, gfx::Size()),
- alignment == Menu2::ALIGN_TOPLEFT ? MenuItemView::TOPLEFT :
- MenuItemView::TOPRIGHT, true);
+ if (menu_runner_->RunMenuAt(NULL, NULL, gfx::Rect(point, gfx::Size()),
+ alignment == Menu2::ALIGN_TOPLEFT ? MenuItemView::TOPLEFT :
+ MenuItemView::TOPRIGHT, MenuRunner::HAS_MNEMONICS) ==
+ MenuRunner::MENU_DELETED)
+ return;
}
void NativeMenuX::CancelMenu() {
@@ -34,10 +39,9 @@ void NativeMenuX::CancelMenu() {
}
void NativeMenuX::Rebuild() {
- if (SubmenuView* submenu = root_->GetSubmenu()) {
+ if (SubmenuView* submenu = root_->GetSubmenu())
submenu->RemoveAllChildViews(true);
- }
- AddMenuItemsFromModel(root_.get(), model_);
+ AddMenuItemsFromModel(root_, model_);
}
void NativeMenuX::UpdateStates() {
« no previous file with comments | « views/controls/menu/native_menu_x.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698