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 "ui/views/controls/menu/menu_runner_impl_interface.h" | 8 #include "ui/views/controls/menu/menu_runner_impl_interface.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "ui/views/controls/menu/menu_controller_delegate.h" | 14 #include "ui/views/controls/menu/menu_controller_delegate.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 | 17 |
18 class MenuController; | 18 class MenuController; |
19 class MenuDelegate; | 19 class MenuDelegate; |
20 class MenuItemView; | 20 class MenuItemView; |
21 | 21 |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 // A menu runner implementation that uses views::MenuItemView to show a menu. | 24 // A menu runner implementation that uses views::MenuItemView to show a menu. |
25 class MenuRunnerImpl : public MenuRunnerImplInterface, | 25 class MenuRunnerImpl : public MenuRunnerImplInterface, |
26 public MenuControllerDelegate { | 26 public MenuControllerDelegate { |
27 public: | 27 public: |
28 explicit MenuRunnerImpl(MenuItemView* menu); | 28 explicit MenuRunnerImpl(MenuItemView* menu); |
29 | 29 |
30 virtual bool IsRunning() const OVERRIDE; | 30 virtual bool IsRunning() const override; |
31 virtual void Release() OVERRIDE; | 31 virtual void Release() override; |
32 virtual MenuRunner::RunResult RunMenuAt(Widget* parent, | 32 virtual MenuRunner::RunResult RunMenuAt(Widget* parent, |
33 MenuButton* button, | 33 MenuButton* button, |
34 const gfx::Rect& bounds, | 34 const gfx::Rect& bounds, |
35 MenuAnchorPosition anchor, | 35 MenuAnchorPosition anchor, |
36 int32 run_types) OVERRIDE; | 36 int32 run_types) override; |
37 virtual void Cancel() OVERRIDE; | 37 virtual void Cancel() override; |
38 virtual base::TimeDelta GetClosingEventTime() const OVERRIDE; | 38 virtual base::TimeDelta GetClosingEventTime() const override; |
39 | 39 |
40 // MenuControllerDelegate: | 40 // MenuControllerDelegate: |
41 virtual void DropMenuClosed(NotifyType type, MenuItemView* menu) OVERRIDE; | 41 virtual void DropMenuClosed(NotifyType type, MenuItemView* menu) override; |
42 virtual void SiblingMenuCreated(MenuItemView* menu) OVERRIDE; | 42 virtual void SiblingMenuCreated(MenuItemView* menu) override; |
43 | 43 |
44 private: | 44 private: |
45 virtual ~MenuRunnerImpl(); | 45 virtual ~MenuRunnerImpl(); |
46 | 46 |
47 // Cleans up after the menu is no longer showing. |result| is the menu that | 47 // Cleans up after the menu is no longer showing. |result| is the menu that |
48 // the user selected, or NULL if nothing was selected. | 48 // the user selected, or NULL if nothing was selected. |
49 MenuRunner::RunResult MenuDone(MenuItemView* result, int mouse_event_flags); | 49 MenuRunner::RunResult MenuDone(MenuItemView* result, int mouse_event_flags); |
50 | 50 |
51 // Returns true if mnemonics should be shown in the menu. | 51 // Returns true if mnemonics should be shown in the menu. |
52 bool ShouldShowMnemonics(MenuButton* button); | 52 bool ShouldShowMnemonics(MenuButton* button); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Used to detect deletion of |this| when notifying delegate of success. | 85 // Used to detect deletion of |this| when notifying delegate of success. |
86 base::WeakPtrFactory<MenuRunnerImpl> weak_factory_; | 86 base::WeakPtrFactory<MenuRunnerImpl> weak_factory_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImpl); | 88 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImpl); |
89 }; | 89 }; |
90 | 90 |
91 } // namespace internal | 91 } // namespace internal |
92 } // namespace views | 92 } // namespace views |
93 | 93 |
94 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ | 94 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ |
OLD | NEW |