Commit 2fd78612 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Use a rect highlight for extensions-menu items

This makes ConfigureBubbleMenuItem public in bubble_menu_item_factory.h
and makes use of it in ExtensionsMenuButton's constructor.

Bug: chromium:943702
Change-Id: I4c28038b73b7ac8b7922da1ac5d348b60777082f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916690
Commit-Queue: Peter Boström <pbos@chromium.org>
Commit-Queue: Caroline Rising <corising@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarCaroline Rising <corising@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715325}
parent fdc23d3e
...@@ -10,23 +10,24 @@ ...@@ -10,23 +10,24 @@
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h" #include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/style/typography.h" #include "ui/views/style/typography.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace { namespace {
constexpr gfx::Insets kDefaultBorderInsets = gfx::Insets(12); constexpr gfx::Insets kDefaultBorderInsets = gfx::Insets(12);
} // namespace
void ConfigureBubbleMenuItem(views::Button* button, int button_id) { void ConfigureBubbleMenuItem(views::Button* button, int button_id) {
// Items within a menu should not show focus rings. // Items within a menu should not show focus rings.
button->SetInstallFocusRingOnFocus(false); button->SetInstallFocusRingOnFocus(false);
button->SetInkDropMode(views::InkDropHostView::InkDropMode::ON); button->SetInkDropMode(views::InkDropHostView::InkDropMode::ON);
views::InstallRectHighlightPathGenerator(button);
button->set_ink_drop_base_color(HoverButton::GetInkDropColor(button)); button->set_ink_drop_base_color(HoverButton::GetInkDropColor(button));
button->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); button->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
button->SetID(button_id); button->SetID(button_id);
} }
} // namespace
std::unique_ptr<views::LabelButton> CreateBubbleMenuItem( std::unique_ptr<views::LabelButton> CreateBubbleMenuItem(
int button_id, int button_id,
const base::string16& name, const base::string16& name,
......
...@@ -11,11 +11,14 @@ ...@@ -11,11 +11,14 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
namespace views { namespace views {
class Button;
class ButtonListener; class ButtonListener;
class ImageButton; class ImageButton;
class LabelButton; class LabelButton;
} // namespace views } // namespace views
void ConfigureBubbleMenuItem(views::Button* button, int button_id);
// Convience method for creating a menu item used inside a bubble that can then // Convience method for creating a menu item used inside a bubble that can then
// be futher configured to hold an image and text. // be futher configured to hold an image and text.
std::unique_ptr<views::LabelButton> CreateBubbleMenuItem( std::unique_ptr<views::LabelButton> CreateBubbleMenuItem(
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/extensions/extensions_menu_button.h" #include "chrome/browser/ui/views/extensions/extensions_menu_button.h"
#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
#include "chrome/browser/ui/views/bubble_menu_item_factory.h"
#include "chrome/browser/ui/views/extensions/extensions_menu_item_view.h" #include "chrome/browser/ui/views/extensions/extensions_menu_item_view.h"
#include "chrome/browser/ui/views/extensions/extensions_menu_view.h" #include "chrome/browser/ui/views/extensions/extensions_menu_view.h"
#include "chrome/browser/ui/views/extensions/extensions_toolbar_button.h" #include "chrome/browser/ui/views/extensions/extensions_toolbar_button.h"
...@@ -26,11 +27,7 @@ ExtensionsMenuButton::ExtensionsMenuButton( ...@@ -26,11 +27,7 @@ ExtensionsMenuButton::ExtensionsMenuButton(
browser_(browser), browser_(browser),
parent_(parent), parent_(parent),
controller_(controller) { controller_(controller) {
SetInkDropMode(InkDropMode::ON); ConfigureBubbleMenuItem(this, 0);
// Items within a menu should not show focus rings.
SetInstallFocusRingOnFocus(false);
SetFocusBehavior(FocusBehavior::ALWAYS);
SetButtonController(std::make_unique<HoverButtonController>( SetButtonController(std::make_unique<HoverButtonController>(
this, this, this, this,
std::make_unique<views::Button::DefaultButtonControllerDelegate>(this))); std::make_unique<views::Button::DefaultButtonControllerDelegate>(this)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment