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

Side by Side Diff: ash/common/shelf/shelf_application_menu_model.h

Issue 2791803002: mash: Move LauncherItemController to ash, rename ShelfItemDelegate. (Closed)
Patch Set: Sync and rebase. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 #ifndef ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_ 5 #ifndef ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_
6 #define ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_ 6 #define ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
12 #include "ash/public/interfaces/shelf.mojom.h" 12 #include "ash/public/interfaces/shelf.mojom.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "ui/base/models/simple_menu_model.h" 14 #include "ui/base/models/simple_menu_model.h"
15 15
16 namespace ash { 16 namespace ash {
17 17
18 class ShelfApplicationMenuModelTestAPI; 18 class ShelfItemDelegate;
19 19
20 // A menu model listing open applications associated with a shelf item. Layout: 20 // A menu model listing open applications associated with a shelf item. Layout:
21 // +---------------------------+ 21 // +---------------------------+
22 // | | 22 // | |
23 // | Shelf Item Title | 23 // | Shelf Item Title |
24 // | | 24 // | |
25 // | [Icon] Menu Item Label | 25 // | [Icon] Menu Item Label |
26 // | [Icon] Menu Item Label | 26 // | [Icon] Menu Item Label |
27 // | | 27 // | |
28 // +---------------------------+ 28 // +---------------------------+
29 class ASH_EXPORT ShelfApplicationMenuModel 29 class ASH_EXPORT ShelfApplicationMenuModel
30 : public ui::SimpleMenuModel, 30 : public ui::SimpleMenuModel,
31 public ui::SimpleMenuModel::Delegate { 31 public ui::SimpleMenuModel::Delegate {
32 public: 32 public:
33 // Makes a menu with a |title|, separators, and |items| for |delegate|. 33 // Makes a menu with a |title|, separators, and |items| for |delegate|.
34 // |delegate| may be null in unit tests that do not execute commands. 34 // |delegate| may be null in unit tests that do not execute commands.
35 ShelfApplicationMenuModel(const base::string16& title, 35 ShelfApplicationMenuModel(const base::string16& title,
36 std::vector<mojom::MenuItemPtr> items, 36 std::vector<mojom::MenuItemPtr> items,
37 mojom::ShelfItemDelegate* delegate); 37 ShelfItemDelegate* delegate);
38 ~ShelfApplicationMenuModel() override; 38 ~ShelfApplicationMenuModel() override;
39 39
40 // ui::SimpleMenuModel::Delegate: 40 // ui::SimpleMenuModel::Delegate:
41 bool IsCommandIdChecked(int command_id) const override; 41 bool IsCommandIdChecked(int command_id) const override;
42 bool IsCommandIdEnabled(int command_id) const override; 42 bool IsCommandIdEnabled(int command_id) const override;
43 void ExecuteCommand(int command_id, int event_flags) override; 43 void ExecuteCommand(int command_id, int event_flags) override;
44 44
45 private: 45 private:
46 friend class ShelfApplicationMenuModelTestAPI; 46 friend class ShelfApplicationMenuModelTestAPI;
47 47
48 // Records UMA metrics when a menu item is selected. 48 // Records UMA metrics when a menu item is selected.
49 void RecordMenuItemSelectedMetrics(int command_id, 49 void RecordMenuItemSelectedMetrics(int command_id,
50 int num_menu_items_enabled); 50 int num_menu_items_enabled);
51 51
52 // The list of menu items as returned from the shelf item's controller. 52 // The list of menu items as returned from the shelf item's controller.
53 std::vector<mojom::MenuItemPtr> items_; 53 std::vector<mojom::MenuItemPtr> items_;
54 54
55 // The shelf item delegate that created the menu and executes its commands. 55 // The shelf item delegate that created the menu and executes its commands.
56 mojom::ShelfItemDelegate* delegate_; 56 ShelfItemDelegate* delegate_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(ShelfApplicationMenuModel); 58 DISALLOW_COPY_AND_ASSIGN(ShelfApplicationMenuModel);
59 }; 59 };
60 60
61 } // namespace ash 61 } // namespace ash
62 62
63 #endif // ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_ 63 #endif // ASH_COMMON_SHELF_SHELF_APPLICATION_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « ash/common/shelf/app_list_shelf_item_delegate.cc ('k') | ash/common/shelf/shelf_application_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698