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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_
8 #include "ui/views/controls/menu/menu_runner_impl_interface.h"
15 // Given a MenuModel, adapts MenuRunnerImpl which expects a MenuItemView.
16 class MenuRunnerImplAdapter
: public MenuRunnerImplInterface
{
18 explicit MenuRunnerImplAdapter(ui::MenuModel
* menu_model
);
20 // MenuRunnerImplInterface:
21 bool IsRunning() const override
;
22 void Release() override
;
23 MenuRunner::RunResult
RunMenuAt(Widget
* parent
,
25 const gfx::Rect
& bounds
,
26 MenuAnchorPosition anchor
,
27 int32 types
) override
;
28 void Cancel() override
;
29 base::TimeDelta
GetClosingEventTime() const override
;
32 ~MenuRunnerImplAdapter() override
;
34 scoped_ptr
<MenuModelAdapter
> menu_model_adapter_
;
35 MenuRunnerImpl
* impl_
;
37 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplAdapter
);
40 } // namespace internal
43 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_