Commit 336c68f1 authored by sky@chromium.org's avatar sky@chromium.org

Fixes the touch build from patch @ 98179. I missed a touch class using

MenuItemView.

BUG=57890
TEST=thorougly test all menus in chrome: bookmarks, wrench menu,
context menu on page, extension menus...
TBR=ben@chromium.org
R=ben@chromium.org

Review URL: http://codereview.chromium.org/7746012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98183 0039d316-1c4b-4281-b951-d872f2087c98
parent a3977232
...@@ -9,13 +9,15 @@ ...@@ -9,13 +9,15 @@
#include "ui/gfx/canvas_skia.h" #include "ui/gfx/canvas_skia.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
#include "views/controls/menu/menu_2.h" #include "views/controls/menu/menu_2.h"
#include "views/controls/menu/menu_runner.h"
#include "views/controls/menu/submenu_view.h" #include "views/controls/menu/submenu_view.h"
namespace views { namespace views {
NativeMenuX::NativeMenuX(Menu2* menu) NativeMenuX::NativeMenuX(Menu2* menu)
: model_(menu->model()), : 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() { NativeMenuX::~NativeMenuX() {
...@@ -23,10 +25,13 @@ NativeMenuX::~NativeMenuX() { ...@@ -23,10 +25,13 @@ NativeMenuX::~NativeMenuX() {
// MenuWrapper implementation: // MenuWrapper implementation:
void NativeMenuX::RunMenuAt(const gfx::Point& point, int alignment) { void NativeMenuX::RunMenuAt(const gfx::Point& point, int alignment) {
// TODO: this should really return the value from MenuRunner.
UpdateStates(); UpdateStates();
root_->RunMenuAt(NULL, NULL, gfx::Rect(point, gfx::Size()), if (menu_runner_->RunMenuAt(NULL, NULL, gfx::Rect(point, gfx::Size()),
alignment == Menu2::ALIGN_TOPLEFT ? MenuItemView::TOPLEFT : alignment == Menu2::ALIGN_TOPLEFT ? MenuItemView::TOPLEFT :
MenuItemView::TOPRIGHT, true); MenuItemView::TOPRIGHT, MenuRunner::HAS_MNEMONICS) ==
MenuRunner::MENU_DELETED)
return;
} }
void NativeMenuX::CancelMenu() { void NativeMenuX::CancelMenu() {
...@@ -34,10 +39,9 @@ void NativeMenuX::CancelMenu() { ...@@ -34,10 +39,9 @@ void NativeMenuX::CancelMenu() {
} }
void NativeMenuX::Rebuild() { void NativeMenuX::Rebuild() {
if (SubmenuView* submenu = root_->GetSubmenu()) { if (SubmenuView* submenu = root_->GetSubmenu())
submenu->RemoveAllChildViews(true); submenu->RemoveAllChildViews(true);
} AddMenuItemsFromModel(root_, model_);
AddMenuItemsFromModel(root_.get(), model_);
} }
void NativeMenuX::UpdateStates() { void NativeMenuX::UpdateStates() {
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -16,6 +16,8 @@ class MenuModel; ...@@ -16,6 +16,8 @@ class MenuModel;
namespace views { namespace views {
class MenuRunner;
// A non-GTK implementation of MenuWrapper, used currently for touchui. // A non-GTK implementation of MenuWrapper, used currently for touchui.
class NativeMenuX : public MenuWrapper, class NativeMenuX : public MenuWrapper,
public MenuDelegate { public MenuDelegate {
...@@ -46,7 +48,8 @@ class NativeMenuX : public MenuWrapper, ...@@ -46,7 +48,8 @@ class NativeMenuX : public MenuWrapper,
// The attached model and delegate. Does not assume ownership. // The attached model and delegate. Does not assume ownership.
ui::MenuModel* model_; ui::MenuModel* model_;
scoped_ptr<MenuItemView> root_; MenuItemView* root_;
scoped_ptr<MenuRunner> menu_runner_;
DISALLOW_COPY_AND_ASSIGN(NativeMenuX); DISALLOW_COPY_AND_ASSIGN(NativeMenuX);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment