Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_ | |
| 6 #define ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "ash/ash_export.h" | |
| 12 #include "ash/public/cpp/shelf_application_menu_item.h" | |
| 13 #include "base/macros.h" | |
| 14 #include "ui/base/models/simple_menu_model.h" | |
| 15 | |
| 16 class ShelfApplicationMenuModelTestAPI; | |
| 17 | |
| 18 namespace ash { | |
| 19 | |
| 20 // A menu model listing open applications associated with a shelf item. | |
|
James Cook
2017/02/06 17:30:21
optional: A little piece of ASCII art showing what
msw
2017/02/07 09:12:00
Done.
| |
| 21 class ASH_EXPORT ShelfApplicationMenuModel | |
| 22 : public ui::SimpleMenuModel, | |
| 23 public ui::SimpleMenuModel::Delegate { | |
| 24 public: | |
| 25 // Makes a menu with a |title|, separators, and the specified |items|. | |
| 26 ShelfApplicationMenuModel(const base::string16& title, | |
| 27 ShelfApplicationMenuItems items); | |
| 28 ~ShelfApplicationMenuModel() override; | |
| 29 | |
| 30 // ui::SimpleMenuModel::Delegate: | |
| 31 bool IsCommandIdChecked(int command_id) const override; | |
| 32 bool IsCommandIdEnabled(int command_id) const override; | |
| 33 void ExecuteCommand(int command_id, int event_flags) override; | |
| 34 | |
| 35 private: | |
| 36 friend class ShelfApplicationMenuModelTestAPI; | |
| 37 | |
| 38 // Records UMA metrics when a menu item is selected. | |
| 39 void RecordMenuItemSelectedMetrics(int command_id, | |
| 40 int num_menu_items_enabled); | |
| 41 | |
| 42 // The list of menu items as returned from the shelf item's controller. | |
| 43 ShelfApplicationMenuItems items_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(ShelfApplicationMenuModel); | |
| 46 }; | |
| 47 | |
| 48 } // namespace ash | |
| 49 | |
| 50 #endif // ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_ | |
| OLD | NEW |