 Chromium Code Reviews
 Chromium Code Reviews Issue 2671923002:
  mash: Cleanup ash shelf application menu code.  (Closed)
    
  
    Issue 2671923002:
  mash: Cleanup ash shelf application menu code.  (Closed) 
  | Index: ash/common/shelf/shelf_controller.cc | 
| diff --git a/ash/common/shelf/shelf_controller.cc b/ash/common/shelf/shelf_controller.cc | 
| index 05def9cb677b786abe38479c1fdc4b4b4b8a0816..0ad56d9b5627b03b84c09282f5858e0286aa5dd4 100644 | 
| --- a/ash/common/shelf/shelf_controller.cc | 
| +++ b/ash/common/shelf/shelf_controller.cc | 
| @@ -53,36 +53,6 @@ class ShelfItemDelegateMus : public ShelfItemDelegate { | 
| void set_title(const base::string16& title) { title_ = title; } | 
| private: | 
| - // This application menu model for ShelfItemDelegateMus lists open windows. | 
| - class ShelfMenuModelMus : public ui::SimpleMenuModel, | 
| - public ui::SimpleMenuModel::Delegate { | 
| - public: | 
| - explicit ShelfMenuModelMus(ShelfItemDelegateMus* item_delegate) | 
| - : ui::SimpleMenuModel(this), item_delegate_(item_delegate) { | 
| - AddSeparator(ui::SPACING_SEPARATOR); | 
| - AddItem(0, item_delegate_->title()); | 
| - AddSeparator(ui::SPACING_SEPARATOR); | 
| - for (const auto& window : item_delegate_->window_id_to_title()) | 
| - AddItem(window.first, window.second); | 
| - AddSeparator(ui::SPACING_SEPARATOR); | 
| - } | 
| - ~ShelfMenuModelMus() override {} | 
| - | 
| - // ui::SimpleMenuModel::Delegate: | 
| - bool IsCommandIdChecked(int command_id) const override { return false; } | 
| - bool IsCommandIdEnabled(int command_id) const override { | 
| - return command_id > 0; | 
| - } | 
| - void ExecuteCommand(int command_id, int event_flags) override { | 
| - NOTIMPLEMENTED(); | 
| - } | 
| - | 
| - private: | 
| - ShelfItemDelegateMus* item_delegate_; | 
| - | 
| - DISALLOW_COPY_AND_ASSIGN(ShelfMenuModelMus); | 
| - }; | 
| - | 
| // ShelfItemDelegate: | 
| ShelfItemDelegate::PerformedAction ItemSelected( | 
| const ui::Event& event) override { | 
| @@ -97,8 +67,12 @@ class ShelfItemDelegateMus : public ShelfItemDelegate { | 
| return kNoAction; | 
| } | 
| - ui::SimpleMenuModel* CreateApplicationMenu(int event_flags) override { | 
| - return new ShelfMenuModelMus(this); | 
| + ShelfApplicationMenuItems GetAppMenuItems(int event_flags) override { | 
| + ShelfApplicationMenuItems items; | 
| + for (const auto& window : window_id_to_title_) | 
| 
James Cook
2017/02/06 17:30:21
nit: {}
 
msw
2017/02/07 09:12:01
Done.
 | 
| + items.push_back( | 
| + base::MakeUnique<ShelfApplicationMenuItem>(window.second, nullptr)); | 
| + return items; | 
| } | 
| void Close() override { NOTIMPLEMENTED(); } |