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

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: one more f 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/toolbar/app_menu_animation.cc ('k') | chrome/browser/ui/views/toolbar/app_menu_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 804c5f696af9525351b9bb0328abd3c34b13e127..c06fb0d920443e858cbb8a0a550f6e064ec30182 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,10 @@ class MenuListener;
class ToolbarView;
-class AppMenuButton : public views::MenuButton,
- public TabStripModelObserver,
- public AppMenuAnimationDelegate {
+// The app menu button lives in the top right of the main browser window. It
+// shows three dots and animates to a hamburger-ish icon when there's a need to
+// alert the user. Clicking displays the app menu.
+class AppMenuButton : public views::MenuButton, public TabStripModelObserver {
public:
explicit AppMenuButton(ToolbarView* toolbar_view);
~AppMenuButton() override;
@@ -58,7 +59,7 @@ class AppMenuButton : public views::MenuButton,
// views::MenuButton:
gfx::Size CalculatePreferredSize() const override;
void Layout() override;
- void PaintButtonContents(gfx::Canvas* canvas) override;
+ void OnThemeChanged() override;
// TabStripObserver:
void TabInsertedAt(TabStripModel* tab_strip_model,
@@ -66,11 +67,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);
@@ -103,8 +99,9 @@ class AppMenuButton : public views::MenuButton,
void OnDragExited() override;
int OnPerformDrop(const ui::DropTargetEvent& event) override;
- AppMenuIconController::Severity severity_;
- AppMenuIconController::IconType type_;
+ AppMenuIconController::Severity severity_ =
+ AppMenuIconController::Severity::NONE;
+ AppMenuIconController::IconType type_ = AppMenuIconController::IconType::NONE;
// Our owning toolbar view.
ToolbarView* toolbar_view_;
@@ -118,18 +115,20 @@ 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 that depicts and animates the icon. TODO(estade): rename to
+ // |animated_icon_| when |should_use_new_icon_| defaults to true and is
+ // removed.
+ views::AnimatedIconView* new_icon_ = nullptr;
// 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_;
+ base::WeakPtrFactory<AppMenuButton> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AppMenuButton);
};
« no previous file with comments | « chrome/browser/ui/toolbar/app_menu_animation.cc ('k') | chrome/browser/ui/views/toolbar/app_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698