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" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 bool foreground) override; | 65 bool foreground) override; |
66 | 66 |
67 // Updates the presentation according to |severity_| and the theme provider. | 67 // Updates the presentation according to |severity_| and the theme provider. |
68 // If |should_animate| is true, the icon should animate. | 68 // If |should_animate| is true, the icon should animate. |
69 void UpdateIcon(bool should_animate); | 69 void UpdateIcon(bool should_animate); |
70 | 70 |
71 // Sets |margin_trailing_| when the browser is maximized and updates layout | 71 // Sets |margin_trailing_| when the browser is maximized and updates layout |
72 // to make the focus rectangle centered. | 72 // to make the focus rectangle centered. |
73 void SetTrailingMargin(int margin); | 73 void SetTrailingMargin(int margin); |
74 | 74 |
| 75 // Animates the icon if possible. The icon will not animate if the severity |
| 76 // level is none, |animation_| is nullptr or |should_use_new_icon_| is false. |
| 77 void AnimateIconIfPossible(); |
| 78 |
75 // Methods called by AppMenuAnimation when the animation has started/ended. | 79 // Methods called by AppMenuAnimation when the animation has started/ended. |
76 // The layer is managed inside these methods. | 80 // The layer is managed inside these methods. |
77 void AppMenuAnimationStarted(); | 81 void AppMenuAnimationStarted(); |
78 void AppMenuAnimationEnded(); | 82 void AppMenuAnimationEnded(); |
79 | 83 |
80 // Opens the app menu immediately during a drag-and-drop operation. | 84 // Opens the app menu immediately during a drag-and-drop operation. |
81 // Used only in testing. | 85 // Used only in testing. |
82 static bool g_open_app_immediately_for_testing; | 86 static bool g_open_app_immediately_for_testing; |
83 | 87 |
84 private: | 88 private: |
(...skipping 23 matching lines...) Expand all Loading... |
108 | 112 |
109 // App model and menu. | 113 // App model and menu. |
110 // Note that the menu should be destroyed before the model it uses, so the | 114 // Note that the menu should be destroyed before the model it uses, so the |
111 // menu should be listed later. | 115 // menu should be listed later. |
112 std::unique_ptr<AppMenuModel> menu_model_; | 116 std::unique_ptr<AppMenuModel> menu_model_; |
113 std::unique_ptr<AppMenu> menu_; | 117 std::unique_ptr<AppMenu> menu_; |
114 | 118 |
115 // Used for animating and drawing the app menu icon. | 119 // Used for animating and drawing the app menu icon. |
116 std::unique_ptr<AppMenuAnimation> animation_; | 120 std::unique_ptr<AppMenuAnimation> animation_; |
117 | 121 |
| 122 // True if the app menu should use the new animated icon. |
| 123 bool should_use_new_icon_; |
| 124 |
118 // Any trailing margin to be applied. Used when the browser is in | 125 // Any trailing margin to be applied. Used when the browser is in |
119 // a maximized state to extend to the full window width. | 126 // a maximized state to extend to the full window width. |
120 int margin_trailing_; | 127 int margin_trailing_; |
121 | 128 |
122 // Used to spawn weak pointers for delayed tasks to open the overflow menu. | 129 // Used to spawn weak pointers for delayed tasks to open the overflow menu. |
123 base::WeakPtrFactory<AppMenuButton> weak_factory_; | 130 base::WeakPtrFactory<AppMenuButton> weak_factory_; |
124 | 131 |
125 DISALLOW_COPY_AND_ASSIGN(AppMenuButton); | 132 DISALLOW_COPY_AND_ASSIGN(AppMenuButton); |
126 }; | 133 }; |
127 | 134 |
128 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ |
OLD | NEW |