Show menu by clicking the menu button
This commit is contained in:
Родитель
43bfce26a7
Коммит
698700716b
|
@ -134,16 +134,6 @@ bool MenuBar::GetMenuButtonFromScreenPoint(const gfx::Point& point,
|
|||
return false;
|
||||
}
|
||||
|
||||
void MenuBar::RunMenu(views::MenuButton* button) {
|
||||
int id = button->tag();
|
||||
ui::MenuModel::ItemType type = menu_model_->GetTypeAt(id);
|
||||
if (type != ui::MenuModel::TYPE_SUBMENU)
|
||||
return;
|
||||
|
||||
MenuDelegate menu_delegate(this);
|
||||
menu_delegate.RunMenu(menu_model_->GetSubmenuModelAt(id), button);
|
||||
}
|
||||
|
||||
const char* MenuBar::GetClassName() const {
|
||||
return kViewClassName;
|
||||
}
|
||||
|
@ -160,7 +150,13 @@ void MenuBar::OnMenuButtonClicked(views::View* source,
|
|||
return;
|
||||
|
||||
views::MenuButton* button = static_cast<views::MenuButton*>(source);
|
||||
RunMenu(button);
|
||||
int id = button->tag();
|
||||
ui::MenuModel::ItemType type = menu_model_->GetTypeAt(id);
|
||||
if (type != ui::MenuModel::TYPE_SUBMENU)
|
||||
return;
|
||||
|
||||
MenuDelegate menu_delegate(this);
|
||||
menu_delegate.RunMenu(menu_model_->GetSubmenuModelAt(id), button);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -49,9 +49,6 @@ class MenuBar : public views::View,
|
|||
ui::MenuModel** menu_model,
|
||||
views::MenuButton** button);
|
||||
|
||||
// Shows the menu with |button|.
|
||||
void RunMenu(views::MenuButton* button);
|
||||
|
||||
protected:
|
||||
// views::View:
|
||||
const char* GetClassName() const override;
|
||||
|
|
|
@ -121,7 +121,8 @@ void MenuDelegate::SwitchToSiblingMenu(views::MenuButton* button) {
|
|||
// nested message loop.
|
||||
content::BrowserThread::PostTask(
|
||||
content::BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(&MenuBar::RunMenu, base::Unretained(menu_bar_), button));
|
||||
base::Bind(base::IgnoreResult(&views::MenuButton::Activate),
|
||||
base::Unretained(button)));
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
Загрузка…
Ссылка в новой задаче