Update linux menu overrides

This commit is contained in:
Brian R. Bondy 2016-04-30 19:56:28 -04:00 committed by Cheng Zhao
parent 0253aec0cd
commit f93fa53aea
4 changed files with 12 additions and 10 deletions

View file

@ -104,7 +104,7 @@ int MenuBar::GetAcceleratorIndex(base::char16 key) {
void MenuBar::ActivateAccelerator(base::char16 key) {
int i = GetAcceleratorIndex(key);
if (i != -1)
static_cast<SubmenuButton*>(child_at(i))->Activate();
static_cast<SubmenuButton*>(child_at(i))->Activate(nullptr);
}
int MenuBar::GetItemCount() const {
@ -141,22 +141,22 @@ const char* MenuBar::GetClassName() const {
void MenuBar::ButtonPressed(views::Button* sender, const ui::Event& event) {
}
void MenuBar::OnMenuButtonClicked(views::View* source,
const gfx::Point& point) {
void MenuBar::OnMenuButtonClicked(views::MenuButton* source,
const gfx::Point& point,
const ui::Event* event) {
// Hide the accelerator when a submenu is activated.
SetAcceleratorVisibility(false);
if (!menu_model_)
return;
views::MenuButton* button = static_cast<views::MenuButton*>(source);
int id = button->tag();
int id = source->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);
menu_delegate.RunMenu(menu_model_->GetSubmenuModelAt(id), source);
}
} // namespace atom

View file

@ -57,8 +57,10 @@ class MenuBar : public views::View,
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// views::MenuButtonListener:
void OnMenuButtonClicked(views::View* source,
const gfx::Point& point) override;
void OnMenuButtonClicked(views::MenuButton* source,
const gfx::Point& point,
const ui::Event* event) override;
private:
SkColor background_color_;

View file

@ -112,7 +112,7 @@ views::MenuItemView* MenuDelegate::GetSiblingMenu(
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(base::IgnoreResult(&views::MenuButton::Activate),
base::Unretained(button)));
base::Unretained(button), nullptr));
}
return nullptr;

View file

@ -26,7 +26,7 @@ base::string16 FilterAccelerator(const base::string16& label) {
SubmenuButton::SubmenuButton(views::ButtonListener* listener,
const base::string16& title,
views::MenuButtonListener* menu_button_listener)
: views::MenuButton(listener, FilterAccelerator(title),
: views::MenuButton(FilterAccelerator(title),
menu_button_listener, false),
accelerator_(0),
show_underline_(false),