OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "ui/views/controls/menu/menu_runner.h" | 10 #include "ui/views/controls/menu/menu_runner.h" |
9 | 11 |
10 namespace views { | 12 namespace views { |
11 | 13 |
12 class MenuItemView; | 14 class MenuItemView; |
13 | 15 |
14 namespace internal { | 16 namespace internal { |
15 | 17 |
16 // An abstract interface for menu runner implementations. | 18 // An abstract interface for menu runner implementations. |
17 // Invoke Release() to destroy. Release() deletes immediately if the menu isn't | 19 // Invoke Release() to destroy. Release() deletes immediately if the menu isn't |
18 // showing. If the menu is showing Release() cancels the menu and when the | 20 // showing. If the menu is showing Release() cancels the menu and when the |
19 // nested RunMenuAt() call returns deletes itself and the menu. | 21 // nested RunMenuAt() call returns deletes itself and the menu. |
20 class MenuRunnerImplInterface { | 22 class MenuRunnerImplInterface { |
21 public: | 23 public: |
22 // Creates a concrete instance for running |menu_model|. | 24 // Creates a concrete instance for running |menu_model|. |
23 // |run_types| is a bitmask of MenuRunner::RunTypes. | 25 // |run_types| is a bitmask of MenuRunner::RunTypes. |
24 static MenuRunnerImplInterface* Create(ui::MenuModel* menu_model, | 26 static MenuRunnerImplInterface* Create(ui::MenuModel* menu_model, |
25 int32 run_types); | 27 int32_t run_types); |
26 | 28 |
27 // Returns true if we're in a nested message loop running the menu. | 29 // Returns true if we're in a nested message loop running the menu. |
28 virtual bool IsRunning() const = 0; | 30 virtual bool IsRunning() const = 0; |
29 | 31 |
30 // See description above class for details. | 32 // See description above class for details. |
31 virtual void Release() = 0; | 33 virtual void Release() = 0; |
32 | 34 |
33 // Runs the menu. See MenuRunner::RunMenuAt for more details. | 35 // Runs the menu. See MenuRunner::RunMenuAt for more details. |
34 virtual MenuRunner::RunResult RunMenuAt(Widget* parent, | 36 virtual MenuRunner::RunResult RunMenuAt(Widget* parent, |
35 MenuButton* button, | 37 MenuButton* button, |
36 const gfx::Rect& bounds, | 38 const gfx::Rect& bounds, |
37 MenuAnchorPosition anchor, | 39 MenuAnchorPosition anchor, |
38 int32 run_types) | 40 int32_t run_types) |
39 WARN_UNUSED_RESULT = 0; | 41 WARN_UNUSED_RESULT = 0; |
40 | 42 |
41 // Hides and cancels the menu. | 43 // Hides and cancels the menu. |
42 virtual void Cancel() = 0; | 44 virtual void Cancel() = 0; |
43 | 45 |
44 // Returns the time from the event which closed the menu - or 0. | 46 // Returns the time from the event which closed the menu - or 0. |
45 virtual base::TimeDelta GetClosingEventTime() const = 0; | 47 virtual base::TimeDelta GetClosingEventTime() const = 0; |
46 | 48 |
47 protected: | 49 protected: |
48 // Call Release() to delete. | 50 // Call Release() to delete. |
49 virtual ~MenuRunnerImplInterface() {} | 51 virtual ~MenuRunnerImplInterface() {} |
50 }; | 52 }; |
51 | 53 |
52 } // namespace internal | 54 } // namespace internal |
53 } // namespace views | 55 } // namespace views |
54 | 56 |
55 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ | 57 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ |
OLD | NEW |