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_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // A menu runner implementation that uses views::MenuItemView to show a menu. | 34 // A menu runner implementation that uses views::MenuItemView to show a menu. |
35 class VIEWS_EXPORT MenuRunnerImpl | 35 class VIEWS_EXPORT MenuRunnerImpl |
36 : NON_EXPORTED_BASE(public MenuRunnerImplInterface), | 36 : NON_EXPORTED_BASE(public MenuRunnerImplInterface), |
37 NON_EXPORTED_BASE(public MenuControllerDelegate) { | 37 NON_EXPORTED_BASE(public MenuControllerDelegate) { |
38 public: | 38 public: |
39 explicit MenuRunnerImpl(MenuItemView* menu); | 39 explicit MenuRunnerImpl(MenuItemView* menu); |
40 | 40 |
41 bool IsRunning() const override; | 41 bool IsRunning() const override; |
42 void Release() override; | 42 void Release() override; |
43 MenuRunner::RunResult RunMenuAt(Widget* parent, | 43 void RunMenuAt(Widget* parent, |
44 MenuButton* button, | 44 MenuButton* button, |
45 const gfx::Rect& bounds, | 45 const gfx::Rect& bounds, |
46 MenuAnchorPosition anchor, | 46 MenuAnchorPosition anchor, |
47 int32_t run_types) override; | 47 int32_t run_types) override; |
48 void Cancel() override; | 48 void Cancel() override; |
49 base::TimeTicks GetClosingEventTime() const override; | 49 base::TimeTicks GetClosingEventTime() const override; |
50 | 50 |
51 // MenuControllerDelegate: | 51 // MenuControllerDelegate: |
52 void OnMenuClosed(NotifyType type, | 52 void OnMenuClosed(NotifyType type, |
53 MenuItemView* menu, | 53 MenuItemView* menu, |
54 int mouse_event_flags) override; | 54 int mouse_event_flags) override; |
55 void SiblingMenuCreated(MenuItemView* menu) override; | 55 void SiblingMenuCreated(MenuItemView* menu) override; |
56 | 56 |
57 private: | 57 private: |
58 friend class ::views::test::MenuRunnerDestructionTest; | 58 friend class ::views::test::MenuRunnerDestructionTest; |
59 | 59 |
60 ~MenuRunnerImpl() override; | 60 ~MenuRunnerImpl() override; |
61 | 61 |
62 // Cleans up after the menu is no longer showing. |result| is the menu that | |
63 // the user selected, or NULL if nothing was selected. | |
64 MenuRunner::RunResult MenuDone(NotifyType type, | |
65 MenuItemView* result, | |
66 int mouse_event_flags); | |
67 | |
68 // Returns true if mnemonics should be shown in the menu. | 62 // Returns true if mnemonics should be shown in the menu. |
69 bool ShouldShowMnemonics(MenuButton* button); | 63 bool ShouldShowMnemonics(MenuButton* button); |
70 | 64 |
71 // The menu. We own this. We don't use scoped_ptr as the destructor is | 65 // The menu. We own this. We don't use scoped_ptr as the destructor is |
72 // protected and we're a friend. | 66 // protected and we're a friend. |
73 MenuItemView* menu_; | 67 MenuItemView* menu_; |
74 | 68 |
75 // Any sibling menus. Does not include |menu_|. We own these too. | 69 // Any sibling menus. Does not include |menu_|. We own these too. |
76 std::set<MenuItemView*> sibling_menus_; | 70 std::set<MenuItemView*> sibling_menus_; |
77 | 71 |
(...skipping 24 matching lines...) Expand all Loading... |
102 // Used to detect deletion of |this| when notifying delegate of success. | 96 // Used to detect deletion of |this| when notifying delegate of success. |
103 base::WeakPtrFactory<MenuRunnerImpl> weak_factory_; | 97 base::WeakPtrFactory<MenuRunnerImpl> weak_factory_; |
104 | 98 |
105 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImpl); | 99 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImpl); |
106 }; | 100 }; |
107 | 101 |
108 } // namespace internal | 102 } // namespace internal |
109 } // namespace views | 103 } // namespace views |
110 | 104 |
111 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ | 105 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ |
OLD | NEW |