| Index: ash/common/shelf/shelf_application_menu_model.cc
|
| diff --git a/ash/common/shelf/shelf_application_menu_model.cc b/ash/common/shelf/shelf_application_menu_model.cc
|
| index 7bf323c12a0339ab022042ad67fa87ca8154c64f..490772f497a731df46c5ee616492021fc4f3348b 100644
|
| --- a/ash/common/shelf/shelf_application_menu_model.cc
|
| +++ b/ash/common/shelf/shelf_application_menu_model.cc
|
| @@ -9,9 +9,8 @@
|
| #include <limits>
|
| #include <utility>
|
|
|
| -#include "ash/common/shelf/shelf_item_delegate.h"
|
| -#include "ash/public/cpp/shelf_application_menu_item.h"
|
| #include "base/metrics/histogram_macros.h"
|
| +#include "ui/gfx/image/image.h"
|
|
|
| namespace {
|
|
|
| @@ -23,18 +22,20 @@ namespace ash {
|
|
|
| ShelfApplicationMenuModel::ShelfApplicationMenuModel(
|
| const base::string16& title,
|
| - ShelfAppMenuItemList items,
|
| - ShelfItemDelegate* delegate)
|
| + std::vector<mojom::MenuItemPtr> items,
|
| + mojom::ShelfItemDelegate* delegate)
|
| : ui::SimpleMenuModel(this), items_(std::move(items)), delegate_(delegate) {
|
| AddSeparator(ui::SPACING_SEPARATOR);
|
| AddItem(kInvalidCommandId, title);
|
| AddSeparator(ui::SPACING_SEPARATOR);
|
|
|
| for (size_t i = 0; i < items_.size(); i++) {
|
| - ShelfApplicationMenuItem* item = items_[i].get();
|
| - AddItem(i, item->title());
|
| - if (!item->icon().IsEmpty())
|
| - SetIcon(GetIndexOfCommandId(i), item->icon());
|
| + mojom::MenuItem* item = items_[i].get();
|
| + AddItem(i, item->label);
|
| + if (!item->image.isNull()) {
|
| + SetIcon(GetIndexOfCommandId(i),
|
| + gfx::Image::CreateFrom1xBitmap(item->image));
|
| + }
|
| }
|
|
|
| // SimpleMenuModel does not allow two consecutive spacing separator items.
|
| @@ -58,7 +59,7 @@ void ShelfApplicationMenuModel::ExecuteCommand(int command_id,
|
| DCHECK(delegate_);
|
| DCHECK(IsCommandIdEnabled(command_id));
|
| // Have the delegate execute its own custom command id for the given item.
|
| - delegate_->ExecuteCommand(items_[command_id]->command_id(), event_flags);
|
| + delegate_->ExecuteCommand(items_[command_id]->command_id, event_flags);
|
| RecordMenuItemSelectedMetrics(command_id, items_.size());
|
| }
|
|
|
|
|