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_ADAPTER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
8 #include "ui/views/controls/menu/menu_runner_impl_interface.h" | 11 #include "ui/views/controls/menu/menu_runner_impl_interface.h" |
9 | 12 |
10 namespace views { | 13 namespace views { |
11 namespace internal { | 14 namespace internal { |
12 | 15 |
13 class MenuRunnerImpl; | 16 class MenuRunnerImpl; |
14 | 17 |
15 // Given a MenuModel, adapts MenuRunnerImpl which expects a MenuItemView. | 18 // Given a MenuModel, adapts MenuRunnerImpl which expects a MenuItemView. |
16 class MenuRunnerImplAdapter : public MenuRunnerImplInterface { | 19 class MenuRunnerImplAdapter : public MenuRunnerImplInterface { |
17 public: | 20 public: |
18 explicit MenuRunnerImplAdapter(ui::MenuModel* menu_model); | 21 explicit MenuRunnerImplAdapter(ui::MenuModel* menu_model); |
19 | 22 |
20 // MenuRunnerImplInterface: | 23 // MenuRunnerImplInterface: |
21 bool IsRunning() const override; | 24 bool IsRunning() const override; |
22 void Release() override; | 25 void Release() override; |
23 MenuRunner::RunResult RunMenuAt(Widget* parent, | 26 MenuRunner::RunResult RunMenuAt(Widget* parent, |
24 MenuButton* button, | 27 MenuButton* button, |
25 const gfx::Rect& bounds, | 28 const gfx::Rect& bounds, |
26 MenuAnchorPosition anchor, | 29 MenuAnchorPosition anchor, |
27 int32 types) override; | 30 int32_t types) override; |
28 void Cancel() override; | 31 void Cancel() override; |
29 base::TimeDelta GetClosingEventTime() const override; | 32 base::TimeDelta GetClosingEventTime() const override; |
30 | 33 |
31 private: | 34 private: |
32 ~MenuRunnerImplAdapter() override; | 35 ~MenuRunnerImplAdapter() override; |
33 | 36 |
34 scoped_ptr<MenuModelAdapter> menu_model_adapter_; | 37 scoped_ptr<MenuModelAdapter> menu_model_adapter_; |
35 MenuRunnerImpl* impl_; | 38 MenuRunnerImpl* impl_; |
36 | 39 |
37 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplAdapter); | 40 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplAdapter); |
38 }; | 41 }; |
39 | 42 |
40 } // namespace internal | 43 } // namespace internal |
41 } // namespace views | 44 } // namespace views |
42 | 45 |
43 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_ | 46 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_ |
OLD | NEW |