Roll src/third_party/skia 591a2ca:b3fe1b8
[chromium-blink-merge.git] / ui / app_list / views / app_list_menu_views.cc
blobdf67a34ce282fa7799f40353cb155ac197dddf40
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 "ui/app_list/app_list_view_delegate.h"
8 #include "ui/views/controls/button/menu_button.h"
9 #include "ui/views/controls/image_view.h"
10 #include "ui/views/controls/label.h"
11 #include "ui/views/controls/menu/menu_config.h"
12 #include "ui/views/controls/menu/menu_item_view.h"
13 #include "ui/views/controls/menu/submenu_view.h"
14 #include "ui/views/layout/grid_layout.h"
16 using views::MenuItemView;
18 namespace app_list {
20 AppListMenuViews::AppListMenuViews(AppListViewDelegate* delegate)
21 : AppListMenu(delegate) {
22 menu_delegate_.reset(new views::MenuModelAdapter(menu_model()));
23 menu_ = new MenuItemView(menu_delegate_.get());
24 menu_runner_.reset(new views::MenuRunner(menu_, 0));
25 menu_delegate_->BuildMenu(menu_);
28 AppListMenuViews::~AppListMenuViews() {}
30 void AppListMenuViews::RunMenuAt(views::MenuButton* button,
31 const gfx::Point& point) {
32 ignore_result(menu_runner_->RunMenuAt(button->GetWidget(),
33 button,
34 gfx::Rect(point, gfx::Size()),
35 views::MENU_ANCHOR_TOPRIGHT,
36 ui::MENU_SOURCE_NONE));
39 void AppListMenuViews::Cancel() {
40 menu_runner_->Cancel();
43 } // namespace app_list