| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/time/time.h" |
| 13 #include "base/timer/timer.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 13 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h" | 15 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h" |
| 14 #include "ui/views/controls/button/menu_button.h" | 16 #include "ui/views/controls/button/menu_button.h" |
| 15 #include "ui/views/controls/button/menu_button_listener.h" | 17 #include "ui/views/controls/button/menu_button_listener.h" |
| 16 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
| 17 | 19 |
| 18 class AppMenu; | 20 class AppMenu; |
| 19 class AppMenuModel; | 21 class AppMenuModel; |
| 20 | 22 |
| 21 namespace views { | 23 namespace views { |
| 22 class LabelButtonBorder; | 24 class LabelButtonBorder; |
| 23 class MenuListener; | 25 class MenuListener; |
| 24 } | 26 } |
| 25 | 27 |
| 26 class AppMenuAnimation; | 28 class AppMenuAnimation; |
| 27 class ToolbarView; | 29 class ToolbarView; |
| 30 class VectorIconAnimator; |
| 28 | 31 |
| 29 class AppMenuButton : public views::MenuButton, public TabStripModelObserver { | 32 class AppMenuButton : public views::MenuButton, public TabStripModelObserver { |
| 30 public: | 33 public: |
| 31 explicit AppMenuButton(ToolbarView* toolbar_view); | 34 explicit AppMenuButton(ToolbarView* toolbar_view); |
| 32 ~AppMenuButton() override; | 35 ~AppMenuButton() override; |
| 33 | 36 |
| 34 void SetSeverity(AppMenuIconController::IconType type, | 37 void SetSeverity(AppMenuIconController::IconType type, |
| 35 AppMenuIconController::Severity severity, | 38 AppMenuIconController::Severity severity, |
| 36 bool animate); | 39 bool animate); |
| 37 | 40 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Listeners to call when the menu opens. | 113 // Listeners to call when the menu opens. |
| 111 base::ObserverList<views::MenuListener> menu_listeners_; | 114 base::ObserverList<views::MenuListener> menu_listeners_; |
| 112 | 115 |
| 113 // App model and menu. | 116 // App model and menu. |
| 114 // Note that the menu should be destroyed before the model it uses, so the | 117 // Note that the menu should be destroyed before the model it uses, so the |
| 115 // menu should be listed later. | 118 // menu should be listed later. |
| 116 std::unique_ptr<AppMenuModel> menu_model_; | 119 std::unique_ptr<AppMenuModel> menu_model_; |
| 117 std::unique_ptr<AppMenu> menu_; | 120 std::unique_ptr<AppMenu> menu_; |
| 118 | 121 |
| 119 // Used for animating and drawing the app menu icon. | 122 // Used for animating and drawing the app menu icon. |
| 120 std::unique_ptr<AppMenuAnimation> animation_; | 123 std::unique_ptr<VectorIconAnimator> animator_; |
| 121 | 124 |
| 122 // True if the app menu should use the new animated icon. | 125 // True if the app menu should use the new animated icon. |
| 123 bool should_use_new_icon_; | 126 bool should_use_new_icon_; |
| 124 | 127 |
| 125 // Any trailing margin to be applied. Used when the browser is in | 128 // Any trailing margin to be applied. Used when the browser is in |
| 126 // a maximized state to extend to the full window width. | 129 // a maximized state to extend to the full window width. |
| 127 int margin_trailing_; | 130 int margin_trailing_; |
| 128 | 131 |
| 132 base::TimeTicks animation_start_time_; |
| 133 base::RepeatingTimer animation_timer_; |
| 134 |
| 129 // Used to spawn weak pointers for delayed tasks to open the overflow menu. | 135 // Used to spawn weak pointers for delayed tasks to open the overflow menu. |
| 130 base::WeakPtrFactory<AppMenuButton> weak_factory_; | 136 base::WeakPtrFactory<AppMenuButton> weak_factory_; |
| 131 | 137 |
| 132 DISALLOW_COPY_AND_ASSIGN(AppMenuButton); | 138 DISALLOW_COPY_AND_ASSIGN(AppMenuButton); |
| 133 }; | 139 }; |
| 134 | 140 |
| 135 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ | 141 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ |
| OLD | NEW |