[cr144] Support SidePanelAnimationCoordinator
`BraveSidePanel` has to provide support to an instance of `SidePanelAnimationCoordinator`, which expected to be accessed by Chromium. Chromium changes: https://chromium.googlesource.com/chromium/src/+/a7e0dd051812f4522ffd6c1dcf6aab755f7f4a56 https://chromium.googlesource.com/chromium/src/+/0a79d10497ab6b7e9fe859356648a5323159a186 commit a7e0dd051812f4522ffd6c1dcf6aab755f7f4a56 Author: dljames <dljames@chromium.org> Date: Wed Nov 19 16:53:25 2025 -0800 [TBHSP] Add ShadowOverlay opacity animation for side panel Defines the shadow overlay opacity animation sequence in SidePanelAnimationCoordinator. ShadowOverlayView observes this animation id to correctly update the opacity value of its shadow. This is done to achieve a specific visual affect requested by UX. Change-Id: Ieab0907f66d1a4e8eb2b97d5af5215325ef88336 Bug: 445452247 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7163705 Reviewed-by: Eshwar Stalin <estalin@chromium.org> Commit-Queue: Darryl James <dljames@chromium.org> Reviewed-by: Caroline Rising <corising@chromium.org> Cr-Commit-Position: refs/heads/main@{#1547545} commit 0a79d10497ab6b7e9fe859356648a5323159a186 Author: dljames <dljames@chromium.org> Date: Mon Nov 17 12:50:48 2025 -0800 [TBHSP] Add animation coordinator for side panel Add an animation coordinator in the side panel to help coordinate all of the other animation sequences that should happen when the side panel is open or closed. Tests will be added in a subsequent patch due to the size of the implementation. Change-Id: I9bb5b6118f1abaf723401d6a7e4e14ee6a2b1ed2 Bug: 445452247 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7139797 Reviewed-by: Eshwar Stalin <estalin@chromium.org> Commit-Queue: Darryl James <dljames@chromium.org> Cr-Commit-Position: refs/heads/main@{#1546098}
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_view.h"
|
||||
#include "chrome/browser/ui/views/side_panel/side_panel_animation_coordinator.h"
|
||||
#include "chrome/browser/ui/views/side_panel/side_panel_animation_ids.h"
|
||||
#include "chrome/browser/ui/views/side_panel/side_panel_ui.h"
|
||||
#include "chrome/browser/ui/views/side_panel/side_panel_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
@@ -81,9 +83,14 @@ SidePanel::SidePanel(BrowserView* browser_view,
|
||||
|
||||
content_parent_view_ = AddChildView(std::make_unique<ContentParentView>());
|
||||
content_parent_view_->SetVisible(false);
|
||||
|
||||
animation_coordinator_ =
|
||||
std::make_unique<SidePanelAnimationCoordinator>(this);
|
||||
animation_coordinator_->AddObserver(kSidePanelBoundsAnimation, this);
|
||||
}
|
||||
|
||||
SidePanel::~SidePanel() {
|
||||
animation_coordinator_->RemoveObserver(kSidePanelBoundsAnimation, this);
|
||||
scoped_observation_.RemoveObservation(this);
|
||||
}
|
||||
|
||||
@@ -156,7 +163,7 @@ gfx::Size SidePanel::GetMinimumSize() const {
|
||||
}
|
||||
|
||||
bool SidePanel::IsClosing() {
|
||||
return false;
|
||||
return animation_coordinator_->IsClosing();
|
||||
}
|
||||
|
||||
void SidePanel::AddedToWidget() {
|
||||
@@ -246,6 +253,13 @@ void SidePanel::OnChildViewRemoved(View* observed_view, View* child) {
|
||||
}
|
||||
}
|
||||
|
||||
void SidePanel::OnAnimationSequenceProgressed(
|
||||
const SidePanelAnimationCoordinator::SidePanelAnimationId& animation_id,
|
||||
double animation_value) {}
|
||||
|
||||
void SidePanel::OnAnimationSequenceEnded(
|
||||
const SidePanelAnimationCoordinator::SidePanelAnimationId& animation_id) {}
|
||||
|
||||
void SidePanel::Open(bool animated) {
|
||||
UpdateVisibility(/*should_be_open=*/true);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/scoped_multi_source_observation.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/ui/views/side_panel/side_panel_animation_coordinator.h"
|
||||
#include "chrome/browser/ui/views/side_panel/side_panel_animation_ids.h"
|
||||
#include "chrome/browser/ui/views/side_panel/side_panel_entry.h"
|
||||
#include "components/prefs/pref_member.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
@@ -33,7 +35,8 @@ class SidebarBrowserTest;
|
||||
// SidebarContainerView controls this panel's visibility.
|
||||
class SidePanel : public views::View,
|
||||
public views::ViewObserver,
|
||||
public views::ResizeAreaDelegate {
|
||||
public views::ResizeAreaDelegate,
|
||||
public SidePanelAnimationCoordinator::Observer {
|
||||
METADATA_HEADER(SidePanel, views::View)
|
||||
public:
|
||||
// Determines the side from which the side panel will appear.
|
||||
@@ -52,6 +55,10 @@ class SidePanel : public views::View,
|
||||
SidePanel& operator=(const SidePanel&) = delete;
|
||||
~SidePanel() override;
|
||||
|
||||
SidePanelAnimationCoordinator* animation_coordinator() {
|
||||
return animation_coordinator_.get();
|
||||
}
|
||||
|
||||
void SetPanelWidth(int width);
|
||||
void UpdateWidthOnEntryChanged();
|
||||
bool ShouldRestrictMaxWidth() const;
|
||||
@@ -114,6 +121,14 @@ class SidePanel : public views::View,
|
||||
void OnChildViewAdded(View* observed_view, View* child) override;
|
||||
void OnChildViewRemoved(View* observed_view, View* child) override;
|
||||
|
||||
// SidePanelAnimationCoordinator::AnimationObserver
|
||||
void OnAnimationSequenceProgressed(
|
||||
const SidePanelAnimationCoordinator::SidePanelAnimationId& animation_id,
|
||||
double animation_value) override;
|
||||
void OnAnimationSequenceEnded(
|
||||
const SidePanelAnimationCoordinator::SidePanelAnimationId& animation_id)
|
||||
override;
|
||||
|
||||
void OnSidePanelWidthChanged();
|
||||
|
||||
// Monitors addition of content view and change content view property that
|
||||
@@ -136,6 +151,11 @@ class SidePanel : public views::View,
|
||||
// Owned by `this` indirectly through the views tree.
|
||||
raw_ptr<views::View> content_parent_view_;
|
||||
State state_ = State::kClosed;
|
||||
|
||||
// The animation coordinator for the side panel. This controls all of the
|
||||
// animations that are tied to the side panel when triggering the show and
|
||||
// hide states.
|
||||
std::unique_ptr<SidePanelAnimationCoordinator> animation_coordinator_;
|
||||
};
|
||||
|
||||
#endif // BRAVE_BROWSER_UI_VIEWS_SIDE_PANEL_SIDE_PANEL_H_
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "brave/browser/ui/views/side_panel/side_panel.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
|
||||
#include "chrome/browser/ui/views/frame/shadow_overlay_view.h"
|
||||
#include "chrome/browser/ui/views/side_panel/side_panel.h"
|
||||
|
||||
#define BrowserViewLayoutDelegateImplOld \
|
||||
|
||||
Reference in New Issue
Block a user