| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
kerenzhu@: PTAL for chrome/browser/ui/webui_browser. Thanks!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks Keren! But I need your approval again after rebasing... thanks!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Idea: what about having the observer on ExtensionToolbarContainer? That way we avoid going: extension context menu controller -> toolbar action view | extension menu item view -> extensions toolbar container. Then, the container can handle it if the source is toolbar action view.
We could also have the observer in `ExtensionsToolbarContainerViewController`, which my idea was to make it platform-agnostic and move the platform dependent to `ExtensionToolbarContainer` or introduce a `ExtensionsToolbarContainerPlatformDelegateViews`
explicit ExtensionContextMenuController(nit: can drop `explicit`
void ExtensionMenuItemView::OnContextMenuShown() {}nit: Lets add a comment that there are no side effects to the menu item when the context menu is shown (that way empty methods looks intentional vs incomplete)
-- although also see proposal in other comment
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Idea: what about having the observer on ExtensionToolbarContainer? That way we avoid going: extension context menu controller -> toolbar action view | extension menu item view -> extensions toolbar container. Then, the container can handle it if the source is toolbar action view.
We could also have the observer in `ExtensionsToolbarContainerViewController`, which my idea was to make it platform-agnostic and move the platform dependent to `ExtensionToolbarContainer` or introduce a `ExtensionsToolbarContainerPlatformDelegateViews`
Thanks for your suggestion! Let me check if I understand it correctly. The change is going to be like:
Am I right?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Shuhei TakahashiIdea: what about having the observer on ExtensionToolbarContainer? That way we avoid going: extension context menu controller -> toolbar action view | extension menu item view -> extensions toolbar container. Then, the container can handle it if the source is toolbar action view.
We could also have the observer in `ExtensionsToolbarContainerViewController`, which my idea was to make it platform-agnostic and move the platform dependent to `ExtensionToolbarContainer` or introduce a `ExtensionsToolbarContainerPlatformDelegateViews`
Thanks for your suggestion! Let me check if I understand it correctly. The change is going to be like:
- Add the `ContextMenuSource` argument to `ExtensionContextMenuController::Observer::OnContextMenu{Shown,Closed}()`
- Make `ExtensionToolbarContainer` directly implement `ExtensionContextMenuController::Observer`. It will handle the event only when the source is the toolbar.
- Drop the `ExtensionContextMenuController::Observer` implementation from `ToolbarActionView` and `ExtensionMenuItemView`.
- Add the `ExtensionContextMenuController::Observer*` argument to the constructor of `ToolbarActionView` and `ExtensionMenuItemView`.
- Let `ToolbarActionView` and `ExtensionMenuItemView` register the given observer as the observer of `ExtensionContextMenuController`.
Am I right?
(1), (2) and (3) correct
For registering the observer, I was thinking of using `ScopedObservation` in `ExtensionsToolbarContainer` and register it directly... but that means the extensions toolbar container needs a reference to extensions context menu controller and that wouldn't work because we have two controllers (toolbar action view and menu item view). Just realized that.
So for my original proposal, you are right. We would need to pass `ExtensionContextMenuController::Observer*` to the constructor of `ToolbarActionView and ExtensionMenuItemView`.. and that would be tricky because we would need to pass `extensions_toolbar_container` to the views.
I was trying to avoid adding more stuff to `ToolbarActionView::Delegate`.. but seems to be the best path. Sorry for the back and forwards, it's a bit hard to see all the connections with all the tangled code :')
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Shuhei TakahashiIdea: what about having the observer on ExtensionToolbarContainer? That way we avoid going: extension context menu controller -> toolbar action view | extension menu item view -> extensions toolbar container. Then, the container can handle it if the source is toolbar action view.
We could also have the observer in `ExtensionsToolbarContainerViewController`, which my idea was to make it platform-agnostic and move the platform dependent to `ExtensionToolbarContainer` or introduce a `ExtensionsToolbarContainerPlatformDelegateViews`
Emilia PazThanks for your suggestion! Let me check if I understand it correctly. The change is going to be like:
- Add the `ContextMenuSource` argument to `ExtensionContextMenuController::Observer::OnContextMenu{Shown,Closed}()`
- Make `ExtensionToolbarContainer` directly implement `ExtensionContextMenuController::Observer`. It will handle the event only when the source is the toolbar.
- Drop the `ExtensionContextMenuController::Observer` implementation from `ToolbarActionView` and `ExtensionMenuItemView`.
- Add the `ExtensionContextMenuController::Observer*` argument to the constructor of `ToolbarActionView` and `ExtensionMenuItemView`.
- Let `ToolbarActionView` and `ExtensionMenuItemView` register the given observer as the observer of `ExtensionContextMenuController`.
Am I right?
(1), (2) and (3) correct
For registering the observer, I was thinking of using `ScopedObservation` in `ExtensionsToolbarContainer` and register it directly... but that means the extensions toolbar container needs a reference to extensions context menu controller and that wouldn't work because we have two controllers (toolbar action view and menu item view). Just realized that.So for my original proposal, you are right. We would need to pass `ExtensionContextMenuController::Observer*` to the constructor of `ToolbarActionView and ExtensionMenuItemView`.. and that would be tricky because we would need to pass `extensions_toolbar_container` to the views.
I was trying to avoid adding more stuff to `ToolbarActionView::Delegate`.. but seems to be the best path. Sorry for the back and forwards, it's a bit hard to see all the connections with all the tangled code :')
No worries, thanks for putting a thought on this!
Thanks for reviews!
| Commit-Queue | +1 |
Removed on top of crrev.com/c/7064871 and I need your approval again. Thanks!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
explicit ExtensionContextMenuController(Shuhei Takahashinit: can drop `explicit`
Done
nit: Lets add a comment that there are no side effects to the menu item when the context menu is shown (that way empty methods looks intentional vs incomplete)
-- although also see proposal in other comment
Oops, overlooked this comment earlier. Added comments.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Removed on top of crrev.com/c/7064871 and I need your approval again. Thanks!
I meant, rebased.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
extensions: Remove context menu callbacks from EAVC
This is a part of the patch series to move stateful UI logic from
ExtensionActionViewController to ExtensionActionPlatformDelegate.
ExtensionsToolbarContainer needs to observe shown/closed events for
context menus attached to toolbar action buttons to update some internal
states. And we used to notify these events in the following path:
ExtensionContextMenuController::ShowContextMenuForViewImpl()
-> ToolbarActionViewController::OnContextMenuShown()
= ExtensionActionViewController::OnContextMenuShown()
-> ExtensionsContainer::OnContextMenuShownFromToolbar()
= ExtensionsToolbarContainer::OnContextMenuShownFromToolbar()
To reduce UI logic from ExtensionActionViewController, we don't want
ExtensionActionViewController to appear in the middle.
To achieve this, this patch reworks how these events are notified. We
introduce the observer interface for ExtensionContextMenuController that
allows its owner to subscribe to context menu events. The observer
interface is implemented by two classes with following behavior:
1. ToolbarActionView: notifies its owner via a delegate.
2. ExtensionMenuItemView: does nothing.
ToolbarActionView::Delegate is already implemented by
ExtensionsToolbarContainer, so it can detect context menu events.
The path for the example above will become:
ExtensionContextMenuController::ShowContextMenuForViewImpl()
-> ExtensionContextMenuController::Observer::OnContextMenuShown()
= ToolbarActionView::OnContextMenuShown()
-> ToolbarActionView::Delegate::OnContextMenuShown()
= ExtensionsToolbarContainer::OnContextMenuShown()
This is a pure refactor. No functional changes are expected.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |