#ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_STARTED_ANIMATION_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_STARTED_ANIMATION_VIEWS_H_
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/widget/widget.h"
class DownloadStartedAnimationViews : public gfx::LinearAnimation,
public views::ImageView {
METADATA_HEADER(DownloadStartedAnimationViews, views::ImageView)
public:
DownloadStartedAnimationViews(content::WebContents* web_contents,
base::TimeDelta duration,
const ui::ImageModel& image);
DownloadStartedAnimationViews(const DownloadStartedAnimationViews&) = delete;
DownloadStartedAnimationViews& operator=(
const DownloadStartedAnimationViews&) = delete;
~DownloadStartedAnimationViews() override = default;
protected:
const gfx::Rect& web_contents_bounds() const { return web_contents_bounds_; }
private:
virtual int GetX() const = 0;
virtual int GetY() const = 0;
virtual int GetWidth() const;
virtual int GetHeight() const;
virtual float GetOpacity() const = 0;
virtual bool WebContentsTooSmall(const gfx::Size& image_size) const;
void Reposition();
void Close();
void AnimateToState(double state) override;
raw_ptr<views::Widget> popup_ = nullptr;
gfx::Rect web_contents_bounds_;
};
#endif