| 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_model.h" | 8 #include "ui/app_list/app_list_model.h" |
| 9 #include "ui/app_list/app_list_view_delegate.h" | 9 #include "ui/app_list/app_list_view_delegate.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 AppListViewDelegate* delegate_; | 123 AppListViewDelegate* delegate_; |
| 124 AppListModel* app_list_model_; // Weak. Owned by AppListView. | 124 AppListModel* app_list_model_; // Weak. Owned by AppListView. |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(AppListMenuModelAdapter); | 126 DISALLOW_COPY_AND_ASSIGN(AppListMenuModelAdapter); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace | 129 } // namespace |
| 130 | 130 |
| 131 AppListMenuViews::AppListMenuViews(AppListViewDelegate* delegate, | 131 AppListMenuViews::AppListMenuViews(AppListViewDelegate* delegate, |
| 132 AppListModel* app_list_model) | 132 AppListModel* app_list_model) |
| 133 : AppListMenu(delegate) { | 133 : AppListMenu(delegate, app_list_model->profile_menu_items()) { |
| 134 menu_delegate_.reset(new AppListMenuModelAdapter(menu_model(), | 134 menu_delegate_.reset(new AppListMenuModelAdapter(menu_model(), |
| 135 delegate, | 135 delegate, |
| 136 app_list_model)); | 136 app_list_model)); |
| 137 menu_ = new MenuItemView(menu_delegate_.get()); | 137 menu_ = new MenuItemView(menu_delegate_.get()); |
| 138 menu_runner_.reset(new views::MenuRunner(menu_)); | 138 menu_runner_.reset(new views::MenuRunner(menu_)); |
| 139 menu_delegate_->BuildMenu(menu_); | 139 menu_delegate_->BuildMenu(menu_); |
| 140 } | 140 } |
| 141 | 141 |
| 142 AppListMenuViews::~AppListMenuViews() {} | 142 AppListMenuViews::~AppListMenuViews() {} |
| 143 | 143 |
| 144 void AppListMenuViews::RunMenuAt(views::MenuButton* button, | 144 void AppListMenuViews::RunMenuAt(views::MenuButton* button, |
| 145 const gfx::Point& point) { | 145 const gfx::Point& point) { |
| 146 ignore_result(menu_runner_->RunMenuAt(button->GetWidget(), button, | 146 ignore_result(menu_runner_->RunMenuAt(button->GetWidget(), button, |
| 147 gfx::Rect(point, gfx::Size()), | 147 gfx::Rect(point, gfx::Size()), |
| 148 MenuItemView::TOPRIGHT, | 148 MenuItemView::TOPRIGHT, |
| 149 ui::MENU_SOURCE_NONE, 0)); | 149 ui::MENU_SOURCE_NONE, 0)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void AppListMenuViews::Cancel() { | 152 void AppListMenuViews::Cancel() { |
| 153 menu_runner_->Cancel(); | 153 menu_runner_->Cancel(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace app_list | 156 } // namespace app_list |
| OLD | NEW |