Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: ash/common/shelf/shelf_controller.cc

Issue 2671923002: mash: Cleanup ash shelf application menu code. (Closed)
Patch Set: Add comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/shelf/shelf_application_menu_model_unittest.cc ('k') | ash/common/shelf/shelf_item_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..02e6f1a60e41434311fc8399ef73a6fa097e03ef 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,13 @@ class ShelfItemDelegateMus : public ShelfItemDelegate {
return kNoAction;
}
- ui::SimpleMenuModel* CreateApplicationMenu(int event_flags) override {
- return new ShelfMenuModelMus(this);
+ ShelfAppMenuItemList GetAppMenuItems(int event_flags) override {
+ ShelfAppMenuItemList items;
+ for (const auto& window : window_id_to_title_) {
+ items.push_back(
+ base::MakeUnique<ShelfApplicationMenuItem>(window.second));
+ }
+ return items;
}
void Close() override { NOTIMPLEMENTED(); }
« no previous file with comments | « ash/common/shelf/shelf_application_menu_model_unittest.cc ('k') | ash/common/shelf/shelf_item_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698