OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_ |
6 #define UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_ | 6 #define UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_ |
7 | 7 |
| 8 #include "ui/base/ui_base_types.h" |
8 #include "ui/views/views_export.h" | 9 #include "ui/views/views_export.h" |
9 | 10 |
10 namespace gfx { | 11 namespace gfx { |
11 class Point; | 12 class Point; |
12 } | 13 } |
13 | 14 |
14 namespace views { | 15 namespace views { |
15 class View; | 16 class View; |
16 | 17 |
17 // ContextMenuController is responsible for showing the context menu for a | 18 // ContextMenuController is responsible for showing the context menu for a |
18 // View. To use a ContextMenuController invoke set_context_menu_controller on a | 19 // View. To use a ContextMenuController invoke set_context_menu_controller on a |
19 // View. When the appropriate user gesture occurs ShowContextMenu is invoked | 20 // View. When the appropriate user gesture occurs ShowContextMenu is invoked |
20 // on the ContextMenuController. | 21 // on the ContextMenuController. |
21 // | 22 // |
22 // Setting a ContextMenuController on a view makes the view process mouse | 23 // Setting a ContextMenuController on a view makes the view process mouse |
23 // events. | 24 // events. |
24 // | 25 // |
25 // It is up to subclasses that do their own mouse processing to invoke | 26 // It is up to subclasses that do their own mouse processing to invoke |
26 // the appropriate ContextMenuController method, typically by invoking super's | 27 // the appropriate ContextMenuController method, typically by invoking super's |
27 // implementation for mouse processing. | 28 // implementation for mouse processing. |
28 class VIEWS_EXPORT ContextMenuController { | 29 class VIEWS_EXPORT ContextMenuController { |
29 public: | 30 public: |
30 // Invoked to show the context menu for |source|. | 31 // Invoked to show the context menu for |source|. |
31 // |point| is in screen coordinates. | 32 // |point| is in screen coordinates. |
32 virtual void ShowContextMenuForView(View* source, | 33 virtual void ShowContextMenuForView(View* source, |
33 const gfx::Point& point) = 0; | 34 const gfx::Point& point, |
| 35 ui::MenuSourceType source_type) = 0; |
34 | 36 |
35 protected: | 37 protected: |
36 virtual ~ContextMenuController() {} | 38 virtual ~ContextMenuController() {} |
37 }; | 39 }; |
38 | 40 |
39 } // namespace views | 41 } // namespace views |
40 | 42 |
41 #endif // UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_ | 43 #endif // UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_ |
OLD | NEW |