1 // Copyright 2013 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 #include "ui/app_list/views/app_list_menu_views.h"
7 #include "grit/ui_resources.h"
8 #include "ui/app_list/app_list_view_delegate.h"
9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/views/controls/button/menu_button.h"
11 #include "ui/views/controls/image_view.h"
12 #include "ui/views/controls/label.h"
13 #include "ui/views/controls/menu/menu_config.h"
14 #include "ui/views/controls/menu/menu_item_view.h"
15 #include "ui/views/controls/menu/submenu_view.h"
16 #include "ui/views/layout/grid_layout.h"
18 using views::MenuItemView
;
22 AppListMenuViews::AppListMenuViews(AppListViewDelegate
* delegate
)
23 : AppListMenu(delegate
) {
24 menu_delegate_
.reset(new views::MenuModelAdapter(menu_model()));
25 menu_
= new MenuItemView(menu_delegate_
.get());
26 menu_runner_
.reset(new views::MenuRunner(menu_
));
27 menu_delegate_
->BuildMenu(menu_
);
30 AppListMenuViews::~AppListMenuViews() {}
32 void AppListMenuViews::RunMenuAt(views::MenuButton
* button
,
33 const gfx::Point
& point
) {
34 ignore_result(menu_runner_
->RunMenuAt(button
->GetWidget(), button
,
35 gfx::Rect(point
, gfx::Size()),
36 MenuItemView::TOPRIGHT
,
37 ui::MENU_SOURCE_NONE
, 0));
40 void AppListMenuViews::Cancel() {
41 menu_runner_
->Cancel();
44 } // namespace app_list