app_context_menu.h revision 90dce4d38c5ff5333bea97d859d4e484e27edf0c
1// Copyright 2013 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_APP_LIST_APP_CONTEXT_MENU_H_ 6#define CHROME_BROWSER_UI_APP_LIST_APP_CONTEXT_MENU_H_ 7 8#include <string> 9 10#include "base/basictypes.h" 11#include "base/memory/scoped_ptr.h" 12#include "ui/base/models/simple_menu_model.h" 13 14class AppListControllerDelegate; 15class Profile; 16 17namespace extensions { 18class Extension; 19class ContextMenuMatcher; 20} 21 22namespace app_list { 23 24class AppContextMenuDelegate; 25 26class AppContextMenu : public ui::SimpleMenuModel::Delegate { 27 public: 28 AppContextMenu(AppContextMenuDelegate* delegate, 29 Profile* profile, 30 const std::string& app_id, 31 AppListControllerDelegate* controller, 32 bool is_platform_app); 33 virtual ~AppContextMenu(); 34 35 // Note this could return NULL if corresponding extension is gone. 36 ui::MenuModel* GetMenuModel(); 37 38 private: 39 const extensions::Extension* GetExtension() const; 40 void ShowExtensionOptions(); 41 void ShowExtensionDetails(); 42 void StartExtensionUninstall(); 43 44 // ui::SimpleMenuModel::Delegate overrides: 45 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; 46 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; 47 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 48 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 49 virtual bool GetAcceleratorForCommandId( 50 int command_id, 51 ui::Accelerator* acclelrator) OVERRIDE; 52 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; 53 54 AppContextMenuDelegate* delegate_; 55 Profile* profile_; 56 const std::string app_id_; 57 AppListControllerDelegate* controller_; 58 bool is_platform_app_; 59 60 scoped_ptr<ui::SimpleMenuModel> menu_model_; 61 scoped_ptr<extensions::ContextMenuMatcher> extension_menu_items_; 62 63 DISALLOW_COPY_AND_ASSIGN(AppContextMenu); 64}; 65 66} // namespace app_list 67 68#endif // CHROME_BROWSER_UI_APP_LIST_APP_CONTEXT_MENU_H_ 69