launcher_application_menu_item_model.h revision 424c4d7b64af9d0d8fd9624f381f469654d5e3d2
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 "ash/launcher/launcher_delegate.h" 9#include "ash/launcher/launcher_item_delegate.h" 10#include "base/memory/scoped_ptr.h" 11#include "base/memory/scoped_vector.h" 12 13class ChromeLauncherAppMenuItem; 14 15// A list of the elements which makes up a simple menu description. 16typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems; 17 18// A menu model that builds the contents of a menu for a launcher item 19// containing a list of running applications. 20class LauncherApplicationMenuItemModel : public ash::LauncherMenuModel, 21 public ui::SimpleMenuModel::Delegate { 22 public: 23 explicit LauncherApplicationMenuItemModel( 24 ChromeLauncherAppMenuItems item_list); 25 virtual ~LauncherApplicationMenuItemModel(); 26 27 // Overridden from ash::LauncherMenuModel: 28 virtual bool IsCommandActive(int command_id) const OVERRIDE; 29 30 // Overridden from ui::SimpleMenuModel::Delegate: 31 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 32 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 33 virtual bool GetAcceleratorForCommandId( 34 int command_id, 35 ui::Accelerator* accelerator) OVERRIDE; 36 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; 37 38 private: 39 void Build(); 40 41 // The list of menu items as returned from the launcher controller. 42 ChromeLauncherAppMenuItems launcher_items_; 43 44 DISALLOW_COPY_AND_ASSIGN(LauncherApplicationMenuItemModel); 45}; 46 47#endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APPLICATION_MENU_ITEM_MODEL_H_ 48