| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ToolbarActionViewController* view_controller() { | 88 ToolbarActionViewController* view_controller() { |
| 89 return view_controller_; | 89 return view_controller_; |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Returns button icon so it can be accessed during tests. | 92 // Returns button icon so it can be accessed during tests. |
| 93 gfx::ImageSkia GetIconForTest(); | 93 gfx::ImageSkia GetIconForTest(); |
| 94 | 94 |
| 95 bool IsMenuRunningForTesting() const; |
| 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 |