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

Unified Diff: chrome/browser/ui/views/toolbar/app_menu_button.h

Issue 2789203003: [Views] App Menu Animated Icon (Closed)
Patch Set: Fix for msw Created 3 years, 8 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
Index: chrome/browser/ui/views/toolbar/app_menu_button.h
diff --git a/chrome/browser/ui/views/toolbar/app_menu_button.h b/chrome/browser/ui/views/toolbar/app_menu_button.h
index 78eb36fe0877bc08531b92f8b320747f8ce6e59d..06167a79a0e81e727016bb0d51ce661221d4493b 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_button.h
+++ b/chrome/browser/ui/views/toolbar/app_menu_button.h
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/toolbar/app_menu_icon_controller.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/button/menu_button_listener.h"
@@ -22,9 +23,10 @@ class LabelButtonBorder;
class MenuListener;
}
+class AppMenuAnimation;
class ToolbarView;
-class AppMenuButton : public views::MenuButton {
+class AppMenuButton : public views::MenuButton, public TabStripModelObserver {
public:
explicit AppMenuButton(ToolbarView* toolbar_view);
~AppMenuButton() override;
@@ -53,14 +55,28 @@ class AppMenuButton : public views::MenuButton {
// views::MenuButton:
gfx::Size GetPreferredSize() const override;
+ void Layout() override;
+ void OnPaint(gfx::Canvas* canvas) override;
+
+ // TabStripObserver:
+ void TabInsertedAt(TabStripModel* tab_strip_model,
+ content::WebContents* contents,
+ int index,
+ bool foreground) override;
// Updates the presentation according to |severity_| and the theme provider.
- void UpdateIcon();
+ // If |should_animate| is true, the icon should animate.
+ void UpdateIcon(bool should_animate);
// Sets |margin_trailing_| when the browser is maximized and updates layout
// to make the focus rectangle centered.
void SetTrailingMargin(int margin);
+ // Methods called by AppMenuAnimation when the animation has started/ended.
+ // The layer is managed inside these methods.
+ void AppMenuAnimationStarted();
+ void AppMenuAnimationEnded();
+
// Opens the app menu immediately during a drag-and-drop operation.
// Used only in testing.
static bool g_open_app_immediately_for_testing;
@@ -96,6 +112,9 @@ class AppMenuButton : public views::MenuButton {
std::unique_ptr<AppMenuModel> menu_model_;
std::unique_ptr<AppMenu> menu_;
+ // Used for animating and drawing the app menu icon.
+ std::unique_ptr<AppMenuAnimation> animation_;
+
// Any trailing margin to be applied. Used when the browser is in
// a maximized state to extend to the full window width.
int margin_trailing_;

Powered by Google App Engine
This is Rietveld 408576698