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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h

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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APPLICATION_MENU_ITEM_MODEL_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APPLICATION_MENU_ITEM_MODEL_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "ui/base/models/simple_menu_model.h"
13
14 class ChromeLauncherAppMenuItem;
15 class LauncherApplicationMenuItemModelTestAPI;
16
17 // A list of the elements which makes up a simple menu description.
18 using ChromeLauncherAppMenuItems =
19 std::vector<std::unique_ptr<ChromeLauncherAppMenuItem>>;
20
21 // A menu model that builds the contents of a menu for a launcher item
22 // containing a list of running applications.
23 class LauncherApplicationMenuItemModel : public ui::SimpleMenuModel,
24 public ui::SimpleMenuModel::Delegate {
25 public:
26 explicit LauncherApplicationMenuItemModel(
27 ChromeLauncherAppMenuItems item_list);
28 ~LauncherApplicationMenuItemModel() override;
29
30 // Overridden from 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 LauncherApplicationMenuItemModelTestAPI;
37
38 void Build();
39
40 // Returns the number of menu items that are enabled.
41 int GetNumMenuItemsEnabled() const;
42
43 // Records UMA metrics when a menu item is selected.
44 void RecordMenuItemSelectedMetrics(int command_id,
45 int num_menu_items_enabled);
46
47 // The list of menu items as returned from the launcher controller.
48 ChromeLauncherAppMenuItems launcher_items_;
49
50 DISALLOW_COPY_AND_ASSIGN(LauncherApplicationMenuItemModel);
51 };
52
53 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APPLICATION_MENU_ITEM_MODEL_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698