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_COCOA_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_COCOA_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_COCOA_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_COCOA_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 <stdint.h> |
| 11 |
10 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 13 #include "base/macros.h" |
11 #include "base/time/time.h" | 14 #include "base/time/time.h" |
12 | 15 |
13 @class MenuController; | 16 @class MenuController; |
14 | 17 |
15 namespace views { | 18 namespace views { |
16 namespace internal { | 19 namespace internal { |
17 | 20 |
18 // A menu runner implementation that uses NSMenu to show a context menu. | 21 // A menu runner implementation that uses NSMenu to show a context menu. |
19 class VIEWS_EXPORT MenuRunnerImplCocoa : public MenuRunnerImplInterface { | 22 class VIEWS_EXPORT MenuRunnerImplCocoa : public MenuRunnerImplInterface { |
20 public: | 23 public: |
21 explicit MenuRunnerImplCocoa(ui::MenuModel* menu); | 24 explicit MenuRunnerImplCocoa(ui::MenuModel* menu); |
22 | 25 |
23 bool IsRunning() const override; | 26 bool IsRunning() const override; |
24 void Release() override; | 27 void Release() override; |
25 MenuRunner::RunResult RunMenuAt(Widget* parent, | 28 MenuRunner::RunResult RunMenuAt(Widget* parent, |
26 MenuButton* button, | 29 MenuButton* button, |
27 const gfx::Rect& bounds, | 30 const gfx::Rect& bounds, |
28 MenuAnchorPosition anchor, | 31 MenuAnchorPosition anchor, |
29 int32 run_types) override; | 32 int32_t run_types) override; |
30 void Cancel() override; | 33 void Cancel() override; |
31 base::TimeDelta GetClosingEventTime() const override; | 34 base::TimeDelta GetClosingEventTime() const override; |
32 | 35 |
33 private: | 36 private: |
34 ~MenuRunnerImplCocoa() override; | 37 ~MenuRunnerImplCocoa() override; |
35 | 38 |
36 // The Cocoa menu controller that this instance is bridging. | 39 // The Cocoa menu controller that this instance is bridging. |
37 base::scoped_nsobject<MenuController> menu_controller_; | 40 base::scoped_nsobject<MenuController> menu_controller_; |
38 | 41 |
39 // Set if |running_| and Release() has been invoked. | 42 // Set if |running_| and Release() has been invoked. |
40 bool delete_after_run_; | 43 bool delete_after_run_; |
41 | 44 |
42 // The timestamp of the event which closed the menu - or 0. | 45 // The timestamp of the event which closed the menu - or 0. |
43 base::TimeDelta closing_event_time_; | 46 base::TimeDelta closing_event_time_; |
44 | 47 |
45 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplCocoa); | 48 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplCocoa); |
46 }; | 49 }; |
47 | 50 |
48 } // namespace internal | 51 } // namespace internal |
49 } // namespace views | 52 } // namespace views |
50 | 53 |
51 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_COCOA_H_ | 54 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_COCOA_H_ |
OLD | NEW |