Cleanup MenuRunner API

https://codereview.chromium.org/2790773002
This commit is contained in:
Aleksei Kuzmin 2017-09-14 00:06:43 +03:00 committed by Cheng Zhao
parent 14eb2af876
commit 338604239d
3 changed files with 6 additions and 8 deletions

View file

@ -54,12 +54,12 @@ void MenuViews::PopupAt(
&MenuViews::ClosePopupAt, weak_factory_.GetWeakPtr(), window_id);
menu_runners_[window_id] = std::unique_ptr<MenuRunner>(new MenuRunner(
model(), flags, close_callback));
ignore_result(menu_runners_[window_id]->RunMenuAt(
menu_runners_[window_id]->RunMenuAt(
static_cast<NativeWindowViews*>(window->window())->widget(),
NULL,
gfx::Rect(location, gfx::Size()),
views::MENU_ANCHOR_TOPLEFT,
ui::MENU_SOURCE_MOUSE));
ui::MENU_SOURCE_MOUSE);
}
void MenuViews::ClosePopupAt(int32_t window_id) {

View file

@ -38,12 +38,12 @@ void MenuDelegate::RunMenu(AtomMenuModel* model, views::MenuButton* button) {
menu_runner_.reset(new views::MenuRunner(
item,
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS));
ignore_result(menu_runner_->RunMenuAt(
menu_runner_->RunMenuAt(
button->GetWidget()->GetTopLevelWidget(),
button,
bounds,
views::MENU_ANCHOR_TOPRIGHT,
ui::MENU_SOURCE_MOUSE));
ui::MENU_SOURCE_MOUSE);
}
void MenuDelegate::ExecuteCommand(int id) {
@ -95,8 +95,7 @@ void MenuDelegate::WillHideMenu(views::MenuItemView* menu) {
adapter_->WillHideMenu(menu);
}
void MenuDelegate::OnMenuClosed(views::MenuItemView* menu,
views::MenuRunner::RunResult result) {
void MenuDelegate::OnMenuClosed(views::MenuItemView* menu) {
// Only switch to new menu when current menu is closed.
if (button_to_open_)
button_to_open_->Activate(nullptr);

View file

@ -40,8 +40,7 @@ class MenuDelegate : public views::MenuDelegate {
void SelectionChanged(views::MenuItemView* menu) override;
void WillShowMenu(views::MenuItemView* menu) override;
void WillHideMenu(views::MenuItemView* menu) override;
void OnMenuClosed(views::MenuItemView* menu,
views::MenuRunner::RunResult result) override;
void OnMenuClosed(views::MenuItemView* menu) override;
views::MenuItemView* GetSiblingMenu(
views::MenuItemView* menu,
const gfx::Point& screen_point,