Commit 24b2408f authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Use AnimationDelegateViews for UnifiedSystemTray animation

Bug: 1019485
Change-Id: I016c2529ad046180be57e8904a16fff9ff0b6c78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1887874Reviewed-by: default avatarJun Mukai <mukai@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710581}
parent 5263961e
......@@ -72,8 +72,9 @@ class ContainerView : public views::View {
UnifiedSystemTrayBubble::UnifiedSystemTrayBubble(UnifiedSystemTray* tray,
bool show_by_click)
: controller_(
std::make_unique<UnifiedSystemTrayController>(tray->model(), this)),
: controller_(std::make_unique<UnifiedSystemTrayController>(tray->model(),
this,
tray)),
tray_(tray) {
if (show_by_click)
time_shown_by_click_ = base::TimeTicks::Now();
......
......@@ -68,11 +68,13 @@ void RecordPageSwitcherSourceByEventType(ui::EventType type,
UnifiedSystemTrayController::UnifiedSystemTrayController(
UnifiedSystemTrayModel* model,
UnifiedSystemTrayBubble* bubble)
: model_(model),
UnifiedSystemTrayBubble* bubble,
views::View* owner_view)
: views::AnimationDelegateViews(owner_view),
model_(model),
bubble_(bubble),
animation_(std::make_unique<gfx::SlideAnimation>(this)) {
animation_->Reset(model->IsExpandedOnOpen() ? 1.0 : 0.0);
animation_->Reset(model_->IsExpandedOnOpen() ? 1.0 : 0.0);
animation_->SetSlideDuration(base::TimeDelta::FromMilliseconds(500));
animation_->SetTweenType(gfx::Tween::EASE_IN_OUT);
......
......@@ -12,8 +12,8 @@
#include "ash/system/audio/unified_volume_slider_controller.h"
#include "ash/system/unified/unified_system_tray_model.h"
#include "base/macros.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/geometry/point.h"
#include "ui/views/animation/animation_delegate_views.h"
namespace gfx {
class SlideAnimation;
......@@ -32,11 +32,12 @@ class UnifiedSystemTrayView;
// Controller class of UnifiedSystemTrayView. Handles events of the view.
class ASH_EXPORT UnifiedSystemTrayController
: public gfx::AnimationDelegate,
: public views::AnimationDelegateViews,
public UnifiedVolumeSliderController::Delegate {
public:
UnifiedSystemTrayController(UnifiedSystemTrayModel* model,
UnifiedSystemTrayBubble* bubble = nullptr);
UnifiedSystemTrayBubble* bubble = nullptr,
views::View* owner_view = nullptr);
~UnifiedSystemTrayController() override;
// Create the view. The created view is unowned.
......@@ -116,7 +117,7 @@ class ASH_EXPORT UnifiedSystemTrayController
// notifications area.
void ResetToCollapsedIfRequired();
// gfx::AnimationDelegate:
// views::AnimationDelegateViews:
void AnimationEnded(const gfx::Animation* animation) override;
void AnimationProgressed(const gfx::Animation* animation) override;
void AnimationCanceled(const gfx::Animation* animation) override;
......
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