diff --git a/atom/browser/api/atom_api_menu_views.cc b/atom/browser/api/atom_api_menu_views.cc index 3a97ad8160..a8d50eeaa8 100644 --- a/atom/browser/api/atom_api_menu_views.cc +++ b/atom/browser/api/atom_api_menu_views.cc @@ -25,16 +25,14 @@ void MenuViews::Popup(Window* window) { cursor = gfx::win::ScreenToDIPPoint(cursor); #endif - menu_runner_.reset(new views::MenuRunner(model())); - views::MenuRunner::RunResult result = menu_runner_->RunMenuAt( + views::MenuRunner menu_runner(model()); + ignore_result(menu_runner.RunMenuAt( static_cast(window->window())->widget(), NULL, gfx::Rect(cursor, gfx::Size()), views::MenuItemView::TOPLEFT, ui::MENU_SOURCE_MOUSE, - views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU); - if (result == views::MenuRunner::MENU_DELETED) - LOG(ERROR) << "Menu deleted when running"; + views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU)); } // static diff --git a/atom/browser/api/atom_api_menu_views.h b/atom/browser/api/atom_api_menu_views.h index 13e5a905e3..dd62df60fe 100644 --- a/atom/browser/api/atom_api_menu_views.h +++ b/atom/browser/api/atom_api_menu_views.h @@ -7,10 +7,6 @@ #include "atom/browser/api/atom_api_menu.h" -namespace views { -class MenuRunner; -} - namespace atom { namespace api { @@ -23,8 +19,6 @@ class MenuViews : public Menu { virtual void Popup(Window* window) OVERRIDE; private: - scoped_ptr menu_runner_; - DISALLOW_COPY_AND_ASSIGN(MenuViews); }; diff --git a/atom/browser/ui/views/menu_delegate.cc b/atom/browser/ui/views/menu_delegate.cc index b1bcb63418..88bba2808d 100644 --- a/atom/browser/ui/views/menu_delegate.cc +++ b/atom/browser/ui/views/menu_delegate.cc @@ -34,16 +34,14 @@ void MenuDelegate::RunMenu(ui::MenuModel* model, views::MenuButton* button) { id_ = button->tag(); views::MenuItemView* item = BuildMenu(model); - menu_runner_.reset(new views::MenuRunner(item)); - views::MenuRunner::RunResult result = menu_runner_->RunMenuAt( + views::MenuRunner menu_runner(item); + ignore_result(menu_runner.RunMenuAt( button->GetWidget()->GetTopLevelWidget(), button, bounds, views::MenuItemView::TOPRIGHT, ui::MENU_SOURCE_MOUSE, - views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU); - if (result == views::MenuRunner::MENU_DELETED) - LOG(ERROR) << "Menu deleted when running"; + views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU)); } views::MenuItemView* MenuDelegate::BuildMenu(ui::MenuModel* model) { diff --git a/atom/browser/ui/views/menu_delegate.h b/atom/browser/ui/views/menu_delegate.h index 310d7da822..1d409e1710 100644 --- a/atom/browser/ui/views/menu_delegate.h +++ b/atom/browser/ui/views/menu_delegate.h @@ -11,7 +11,6 @@ namespace views { class MenuModelAdapter; -class MenuRunner; } namespace ui { @@ -59,7 +58,6 @@ class MenuDelegate : public views::MenuDelegate { views::MenuDelegate* delegate() const { return delegates_[id_]; } MenuBar* menu_bar_; - scoped_ptr menu_runner_; // Current item's id. int id_;