Consider making ToolbarButton and AppMenuButton inherit from a common base class |
||||
Issue descriptionToolbarButton 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.
,
Nov 21
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.
,
Nov 21
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).
,
Nov 21
,
Nov 22
|
||||
►
Sign in to add a comment |
||||
Comment 1 by cyan@chromium.org
, Aug 21Status: Assigned (was: Untriaged)