New issue
Advanced search Search tips

Issue 819854 link

Starred by 3 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Consider making ToolbarButton and AppMenuButton inherit from a common base class

Project Member Reported by afakhry@chromium.org, Mar 8 2018

Issue description

ToolbarButton and AppMenuButton seem to share some code, especially in handling ink drops. It would be better to put the common code into a shared base class.
 
Owner: cyan@chromium.org
Status: Assigned (was: Untriaged)
This is the current architecture of inheritance.
LabelButton -> MenuButton -> AppMenuButton
LabelBUtton -> ToolbarButton

If common code is put into a base class, the architecture of inheritance will be this.
LabelButton -> MenuButton -> ToolbarButtonBase -> AppMenuButton
LabelButton -> ToolbarButtonBase -> ToolbarButton

For no changing the architecture of inheritance to be possible, A template should be used to implement ToolbarButtonBase.

For example,
ToolbarButtonBase<views::LabelButton> or ToolbarButtonBase<views::MenuButton>.

I'd like to implement it, if this is okay.
Status: Started (was: Assigned)
Hi!

We'd definitely like to avoid templates here. The root cause of our problem is that menu button behavior (or "being a menu button") is part of inheritance and not a property of the button.

cyan@'s already working on breaking button behavior out from the inheritance structure, so AppMenuButton would be able to set "act as a menu button" as a property not related to its inheritance. That way the inheritance structure would be:

LabelButton->ToolbarButton->AppMenuButton

ToolbarButton would install its own event handler (SetButtonEventHandler(ToolbarButtonEventHandler) and AppMenuButton would override it by calling SetButtonEventHandler(MenuButtonEventHandler). In this world the implementation of MenuButton itself is fairly trivial (just calls SetButtonEventHandler in its constructor).
Cc: pbos@chromium.org
Labels: Hotlist-DesktopUIToolingRequired Hotlist-DesktopUIChecked

Sign in to add a comment