OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/app_list/views/app_list_menu_views.h" | 5 #include "ui/app_list/views/app_list_menu_views.h" |
6 | 6 |
7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
8 #include "ui/app_list/app_list_view_delegate.h" | 8 #include "ui/app_list/app_list_view_delegate.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/views/controls/button/menu_button.h" | 10 #include "ui/views/controls/button/menu_button.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 class AppListMenuModelAdapter : public views::MenuModelAdapter { | 88 class AppListMenuModelAdapter : public views::MenuModelAdapter { |
89 public: | 89 public: |
90 AppListMenuModelAdapter(ui::MenuModel* menu_model, | 90 AppListMenuModelAdapter(ui::MenuModel* menu_model, |
91 AppListViewDelegate* delegate) | 91 AppListViewDelegate* delegate) |
92 : views::MenuModelAdapter(menu_model), | 92 : views::MenuModelAdapter(menu_model), |
93 delegate_(delegate) {} | 93 delegate_(delegate) {} |
94 virtual ~AppListMenuModelAdapter() {} | 94 virtual ~AppListMenuModelAdapter() {} |
95 | 95 |
96 // Overridden from views::MenuModelAdapter: | 96 // Overridden from views::MenuModelAdapter: |
97 MenuItemView* AppendMenuItem(MenuItemView* menu, | 97 virtual MenuItemView* AppendMenuItem(MenuItemView* menu, |
98 ui::MenuModel* model, | 98 ui::MenuModel* model, |
99 int index) OVERRIDE { | 99 int index) OVERRIDE { |
100 if (!delegate_) | 100 if (!delegate_) |
101 return NULL; | 101 return NULL; |
102 | 102 |
103 int id = model->GetCommandIdAt(index); | 103 int id = model->GetCommandIdAt(index); |
104 if (id != AppListMenu::CURRENT_USER) | 104 if (id != AppListMenu::CURRENT_USER) |
105 return MenuModelAdapter::AppendMenuItem(menu, model, index); | 105 return MenuModelAdapter::AppendMenuItem(menu, model, index); |
106 | 106 |
107 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 107 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
108 MenuItemView* item = new CurrentUserMenuItem( | 108 MenuItemView* item = new CurrentUserMenuItem( |
109 menu, | 109 menu, |
(...skipping 29 matching lines...) Expand all Loading... |
139 ignore_result(menu_runner_->RunMenuAt(button->GetWidget(), button, | 139 ignore_result(menu_runner_->RunMenuAt(button->GetWidget(), button, |
140 gfx::Rect(point, gfx::Size()), | 140 gfx::Rect(point, gfx::Size()), |
141 MenuItemView::TOPRIGHT, 0)); | 141 MenuItemView::TOPRIGHT, 0)); |
142 } | 142 } |
143 | 143 |
144 void AppListMenuViews::Cancel() { | 144 void AppListMenuViews::Cancel() { |
145 menu_runner_->Cancel(); | 145 menu_runner_->Cancel(); |
146 } | 146 } |
147 | 147 |
148 } // namespace app_list | 148 } // namespace app_list |
OLD | NEW |