Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6893)

Unified Diff: chrome/browser/ui/toolbar/app_menu_animation.h

Issue 2858313002: Refactored AppMenuAnimation (Closed)
Patch Set: Fix for msw Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/toolbar/app_menu_animation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/toolbar/app_menu_animation.h
diff --git a/chrome/browser/ui/views/toolbar/app_menu_animation.h b/chrome/browser/ui/toolbar/app_menu_animation.h
similarity index 76%
rename from chrome/browser/ui/views/toolbar/app_menu_animation.h
rename to chrome/browser/ui/toolbar/app_menu_animation.h
index 122b1c976ea03c613e776a636cf85e154d0db9d1..2f9383451fbbbf86105760a69dd2c2f5c91388ba 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_animation.h
+++ b/chrome/browser/ui/toolbar/app_menu_animation.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_ANIMATION_H_
-#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_ANIMATION_H_
+#ifndef CHROME_BROWSER_UI_TOOLBAR_APP_MENU_ANIMATION_H_
+#define CHROME_BROWSER_UI_TOOLBAR_APP_MENU_ANIMATION_H_
#include "base/time/time.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -15,20 +15,28 @@ class Canvas;
class PointF;
} // namespace gfx
-class AppMenuButton;
+// Delegate class for AppMenuAnimation. The delegate is expected to
+// handle animation events and invalidate the platform's view.
+class AppMenuAnimationDelegate {
+ public:
+ // Called when the animation has started/ended.
+ virtual void AppMenuAnimationStarted() = 0;
+ virtual void AppMenuAnimationEnded() = 0;
+
+ // Schedules a redraw of the icon.
+ virtual void InvalidateIcon() = 0;
+};
// This class is used for animating and drawing the app menu icon.
class AppMenuAnimation : public gfx::AnimationDelegate {
public:
- AppMenuAnimation(AppMenuButton* owner, SkColor initial_color);
+ AppMenuAnimation(AppMenuAnimationDelegate* owner, SkColor initial_color);
~AppMenuAnimation() override;
// Paints the app menu icon.
void PaintAppMenu(gfx::Canvas* canvas, const gfx::Rect& bounds);
- void set_target_color(SkColor target_color) { target_color_ = target_color; }
-
// Starts the animation if it's not already running.
void StartAnimation();
@@ -36,6 +44,8 @@ class AppMenuAnimation : public gfx::AnimationDelegate {
void AnimationEnded(const gfx::Animation* animation) override;
void AnimationProgressed(const gfx::Animation* animation) override;
+ void set_target_color(SkColor target_color) { target_color_ = target_color; }
+
private:
// This class is used to represent and paint a dot on the app menu.
class AppMenuDot {
@@ -53,7 +63,8 @@ class AppMenuAnimation : public gfx::AnimationDelegate {
SkColor final_color,
gfx::Canvas* canvas,
const gfx::Rect& bounds,
- const gfx::SlideAnimation* animation);
+ const gfx::SlideAnimation* animation,
+ AppMenuAnimationDelegate* delegate);
private:
// The delay before the dot starts animating in ms.
@@ -67,7 +78,7 @@ class AppMenuAnimation : public gfx::AnimationDelegate {
DISALLOW_COPY_AND_ASSIGN(AppMenuDot);
};
- AppMenuButton* const owner_;
+ AppMenuAnimationDelegate* const delegate_;
std::unique_ptr<gfx::SlideAnimation> animation_;
@@ -86,4 +97,4 @@ class AppMenuAnimation : public gfx::AnimationDelegate {
DISALLOW_COPY_AND_ASSIGN(AppMenuAnimation);
};
-#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_ANIMATION_H_
+#endif // CHROME_BROWSER_UI_TOOLBAR_APP_MENU_ANIMATION_H_
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/toolbar/app_menu_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698