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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 bool ShouldShowInkDropHighlight() const override; | 77 bool ShouldShowInkDropHighlight() const override; |
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 // ToolbarActionViewDelegateViews: | |
88 bool IsMenuRunning() const override; | |
Devlin
2016/08/25 16:42:12
I'd slightly prefer this wrapped in a ForTesting()
jonross
2016/08/25 18:29:27
Done. I've placed the actual override back in priv
| |
87 | 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; |
112 | 109 |
113 // ToolbarActionViewDelegateViews: | 110 // ToolbarActionViewDelegateViews: |
114 views::View* GetAsView() override; | 111 views::View* GetAsView() override; |
115 views::FocusManager* GetFocusManagerForAccelerator() override; | 112 views::FocusManager* GetFocusManagerForAccelerator() override; |
116 views::View* GetReferenceViewForPopup() override; | 113 views::View* GetReferenceViewForPopup() override; |
117 bool IsMenuRunning() const override; | |
118 void OnPopupShown(bool by_user) override; | 114 void OnPopupShown(bool by_user) override; |
119 void OnPopupClosed() override; | 115 void OnPopupClosed() override; |
120 | 116 |
121 // views::ContextMenuController: | 117 // views::ContextMenuController: |
122 void ShowContextMenuForView(views::View* source, | 118 void ShowContextMenuForView(views::View* source, |
123 const gfx::Point& point, | 119 const gfx::Point& point, |
124 ui::MenuSourceType source_type) override; | 120 ui::MenuSourceType source_type) override; |
125 | 121 |
126 // Shows the context menu (if one exists) for the toolbar action. | 122 // Shows the context menu (if one exists) for the toolbar action. |
127 void DoShowContextMenu(ui::MenuSourceType source_type); | 123 void DoShowContextMenu(ui::MenuSourceType source_type); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 | 159 |
164 // The time the popup was last closed. | 160 // The time the popup was last closed. |
165 base::TimeTicks popup_closed_time_; | 161 base::TimeTicks popup_closed_time_; |
166 | 162 |
167 base::WeakPtrFactory<ToolbarActionView> weak_factory_; | 163 base::WeakPtrFactory<ToolbarActionView> weak_factory_; |
168 | 164 |
169 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 165 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
170 }; | 166 }; |
171 | 167 |
172 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 168 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
OLD | NEW |