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

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

Issue 2892563004: Use animated vector icon for app menu notification animation. (Closed)
Patch Set: gfx_export 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
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 b8fc2befaa068c6da278befeef99c5518773fea4..8166c1f9e8abae2fdee1ced215a3bb5aa9a93190 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_button.h
+++ b/chrome/browser/ui/views/toolbar/app_menu_button.h
@@ -10,8 +10,8 @@
#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_animation.h"
#include "chrome/browser/ui/toolbar/app_menu_icon_controller.h"
+#include "ui/views/controls/animated_icon_view.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/button/menu_button_listener.h"
#include "ui/views/view.h"
@@ -26,9 +26,7 @@ class MenuListener;
class ToolbarView;
-class AppMenuButton : public views::MenuButton,
- public TabStripModelObserver,
- public AppMenuAnimationDelegate {
+class AppMenuButton : public views::MenuButton, public TabStripModelObserver {
public:
explicit AppMenuButton(ToolbarView* toolbar_view);
~AppMenuButton() override;
@@ -58,7 +56,7 @@ class AppMenuButton : public views::MenuButton,
// views::MenuButton:
gfx::Size GetPreferredSize() const override;
void Layout() override;
- void OnPaint(gfx::Canvas* canvas) override;
+ void OnThemeChanged() override;
// TabStripObserver:
void TabInsertedAt(TabStripModel* tab_strip_model,
@@ -66,11 +64,6 @@ class AppMenuButton : public views::MenuButton,
int index,
bool foreground) override;
- // AppMenuAnimationDelegate:
- void AppMenuAnimationStarted() override;
- void AppMenuAnimationEnded() override;
- void InvalidateIcon() override;
-
// Updates the presentation according to |severity_| and the theme provider.
// If |should_animate| is true, the icon should animate.
void UpdateIcon(bool should_animate);
@@ -118,15 +111,18 @@ 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_;
+ // The view which displays three dots and animates to a hamburger-ish icon
+ // when there's a need to alert the user. TODO(estade): rename to
Peter Kasting 2017/05/31 02:08:29 Nit: Can this first sentence just be "The menu ico
Evan Stade 2017/05/31 17:08:16 I understand the concern but I think specificity i
Peter Kasting 2017/05/31 17:24:31 I think there's value in describing what this is,
Evan Stade 2017/05/31 20:19:13 Seems like it could go either way. If you're chang
+ // |animated_icon_| when |should_use_new_icon_| defaults to true and is
+ // removed.
+ views::AnimatedIconView* new_icon_ = nullptr;
Peter Kasting 2017/05/31 02:08:29 Nit: I really like initing members in the declarat
Evan Stade 2017/05/31 17:08:16 good call. Updated all except toolbar_view_, which
// True if the app menu should use the new animated icon.
- bool should_use_new_icon_;
+ bool should_use_new_icon_ = false;
// 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_;
+ int margin_trailing_ = 0;
// Used to spawn weak pointers for delayed tasks to open the overflow menu.
base::WeakPtrFactory<AppMenuButton> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698