Infobar material design refresh: layout
[chromium-blink-merge.git] / chrome / browser / ui / ash / launcher / launcher_application_menu_item_model.h
blob6acadce28212054435a9c5df585e71d8737f118c
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.
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_
8 #include "ash/shelf/shelf_menu_model.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h"
12 class ChromeLauncherAppMenuItem;
13 class LauncherApplicationMenuItemModelTestAPI;
15 // A list of the elements which makes up a simple menu description.
16 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems;
18 // A menu model that builds the contents of a menu for a launcher item
19 // containing a list of running applications.
20 class LauncherApplicationMenuItemModel : public ash::ShelfMenuModel,
21 public ui::SimpleMenuModel::Delegate {
22 public:
23 explicit LauncherApplicationMenuItemModel(
24 ChromeLauncherAppMenuItems item_list);
25 ~LauncherApplicationMenuItemModel() override;
27 // Overridden from ash::ShelfMenuModel:
28 bool IsCommandActive(int command_id) const override;
30 // Overridden from ui::SimpleMenuModel::Delegate:
31 bool IsCommandIdChecked(int command_id) const override;
32 bool IsCommandIdEnabled(int command_id) const override;
33 bool GetAcceleratorForCommandId(int command_id,
34 ui::Accelerator* accelerator) override;
35 void ExecuteCommand(int command_id, int event_flags) override;
37 private:
38 friend class LauncherApplicationMenuItemModelTestAPI;
40 void Build();
42 // Returns the number of menu items that are enabled.
43 int GetNumMenuItemsEnabled() const;
45 // Records UMA metrics when a menu item is selected.
46 void RecordMenuItemSelectedMetrics(int command_id,
47 int num_menu_items_enabled);
49 // The list of menu items as returned from the launcher controller.
50 ChromeLauncherAppMenuItems launcher_items_;
52 DISALLOW_COPY_AND_ASSIGN(LauncherApplicationMenuItemModel);
55 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APPLICATION_MENU_ITEM_MODEL_H_