diff --git a/atom/browser/ui/views/menu_bar.cc b/atom/browser/ui/views/menu_bar.cc index 0530ec6d401..bd7c4fcac9d 100644 --- a/atom/browser/ui/views/menu_bar.cc +++ b/atom/browser/ui/views/menu_bar.cc @@ -63,8 +63,7 @@ void MenuBar::SetMenu(AtomMenuModel* model) { RemoveAllChildViews(true); for (int i = 0; i < model->GetItemCount(); ++i) { - SubmenuButton* button = new SubmenuButton(this, - model->GetLabelAt(i), + SubmenuButton* button = new SubmenuButton(model->GetLabelAt(i), this, background_color_); button->set_tag(i); @@ -134,9 +133,6 @@ const char* MenuBar::GetClassName() const { return kViewClassName; } -void MenuBar::ButtonPressed(views::Button* sender, const ui::Event& event) { -} - void MenuBar::OnMenuButtonClicked(views::MenuButton* source, const gfx::Point& point, const ui::Event* event) { diff --git a/atom/browser/ui/views/menu_bar.h b/atom/browser/ui/views/menu_bar.h index 5b86e292c88..0f371ea0ce7 100644 --- a/atom/browser/ui/views/menu_bar.h +++ b/atom/browser/ui/views/menu_bar.h @@ -6,7 +6,6 @@ #define ATOM_BROWSER_UI_VIEWS_MENU_BAR_H_ #include "atom/browser/ui/atom_menu_model.h" -#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/menu_button_listener.h" #include "ui/views/view.h" @@ -19,7 +18,6 @@ namespace atom { class MenuDelegate; class MenuBar : public views::View, - public views::ButtonListener, public views::MenuButtonListener { public: MenuBar(); @@ -50,9 +48,6 @@ class MenuBar : public views::View, // views::View: const char* GetClassName() const override; - // views::ButtonListener: - void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // views::MenuButtonListener: void OnMenuButtonClicked(views::MenuButton* source, const gfx::Point& point, diff --git a/atom/browser/ui/views/submenu_button.cc b/atom/browser/ui/views/submenu_button.cc index 49a678a0358..2b356202280 100644 --- a/atom/browser/ui/views/submenu_button.cc +++ b/atom/browser/ui/views/submenu_button.cc @@ -26,8 +26,7 @@ base::string16 FilterAccelerator(const base::string16& label) { } // namespace -SubmenuButton::SubmenuButton(views::ButtonListener* listener, - const base::string16& title, +SubmenuButton::SubmenuButton(const base::string16& title, views::MenuButtonListener* menu_button_listener, const SkColor& background_color) : views::MenuButton(FilterAccelerator(title), @@ -53,6 +52,10 @@ SubmenuButton::SubmenuButton(views::ButtonListener* listener, SetHasInkDrop(true); set_ink_drop_base_color( color_utils::BlendTowardOppositeLuma(background_color_, 0x61)); + + set_request_focus_on_press(true); + SetFocusForPlatform(); + SetFocusPainter(nullptr); } SubmenuButton::~SubmenuButton() { diff --git a/atom/browser/ui/views/submenu_button.h b/atom/browser/ui/views/submenu_button.h index c798b02c8d9..02e25cd0deb 100644 --- a/atom/browser/ui/views/submenu_button.h +++ b/atom/browser/ui/views/submenu_button.h @@ -13,8 +13,7 @@ namespace atom { // Special button that used by menu bar to show submenus. class SubmenuButton : public views::MenuButton { public: - SubmenuButton(views::ButtonListener* listener, - const base::string16& title, + SubmenuButton(const base::string16& title, views::MenuButtonListener* menu_button_listener, const SkColor& background_color); virtual ~SubmenuButton();