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_TOOLBAR_ACTION_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" | 10 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 | 78 |
79 // ToolbarActionViewDelegateViews: | 79 // ToolbarActionViewDelegateViews: |
80 content::WebContents* GetCurrentWebContents() const override; | 80 content::WebContents* GetCurrentWebContents() const override; |
81 void UpdateState() override; | 81 void UpdateState() override; |
82 | 82 |
83 // views::MenuButtonListener: | 83 // views::MenuButtonListener: |
84 void OnMenuButtonClicked(views::MenuButton* source, | 84 void OnMenuButtonClicked(views::MenuButton* source, |
85 const gfx::Point& point, | 85 const gfx::Point& point, |
86 const ui::Event* event) override; | 86 const ui::Event* event) override; |
87 | 87 |
88 bool IsMenuRunningForTesting() const; | |
Devlin
2016/08/25 18:41:44
nit: put this near the other testing methods.
jonross
2016/08/25 20:06:26
Done.
| |
89 | |
88 ToolbarActionViewController* view_controller() { | 90 ToolbarActionViewController* view_controller() { |
89 return view_controller_; | 91 return view_controller_; |
90 } | 92 } |
91 | 93 |
92 // Returns button icon so it can be accessed during tests. | 94 // Returns button icon so it can be accessed during tests. |
93 gfx::ImageSkia GetIconForTest(); | 95 gfx::ImageSkia GetIconForTest(); |
94 | 96 |
95 bool wants_to_run_for_testing() const { return wants_to_run_; } | 97 bool wants_to_run_for_testing() const { return wants_to_run_; } |
96 | 98 |
97 // Set a callback to be called directly before the context menu is shown. | |
98 // The toolbar action opening the menu will be passed in. | |
99 static void set_context_menu_callback_for_testing( | |
100 ContextMenuCallback* callback); | |
101 | |
102 views::MenuItemView* menu_for_testing() { return menu_; } | 99 views::MenuItemView* menu_for_testing() { return menu_; } |
103 | 100 |
104 private: | 101 private: |
105 // views::MenuButton: | 102 // views::MenuButton: |
106 gfx::Size GetPreferredSize() const override; | 103 gfx::Size GetPreferredSize() const override; |
107 bool OnMousePressed(const ui::MouseEvent& event) override; | 104 bool OnMousePressed(const ui::MouseEvent& event) override; |
108 void OnGestureEvent(ui::GestureEvent* event) override; | 105 void OnGestureEvent(ui::GestureEvent* event) override; |
109 void OnDragDone() override; | 106 void OnDragDone() override; |
110 void ViewHierarchyChanged( | 107 void ViewHierarchyChanged( |
111 const ViewHierarchyChangedDetails& details) override; | 108 const ViewHierarchyChangedDetails& details) override; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 | 160 |
164 // The time the popup was last closed. | 161 // The time the popup was last closed. |
165 base::TimeTicks popup_closed_time_; | 162 base::TimeTicks popup_closed_time_; |
166 | 163 |
167 base::WeakPtrFactory<ToolbarActionView> weak_factory_; | 164 base::WeakPtrFactory<ToolbarActionView> weak_factory_; |
168 | 165 |
169 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 166 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
170 }; | 167 }; |
171 | 168 |
172 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 169 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
OLD | NEW |