app_context_menu.h revision 68043e1e95eeb07d5cae7aca370b26518b0867d6
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 bool is_search_result_); 34 virtual ~AppContextMenu(); 35 36 // Note this could return NULL if corresponding extension is gone. 37 ui::MenuModel* GetMenuModel(); 38 39 private: 40 const extensions::Extension* GetExtension() const; 41 void ShowExtensionOptions(); 42 void ShowExtensionDetails(); 43 void StartExtensionUninstall(); 44 45 // ui::SimpleMenuModel::Delegate overrides: 46 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; 47 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; 48 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 49 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 50 virtual bool GetAcceleratorForCommandId( 51 int command_id, 52 ui::Accelerator* acclelrator) OVERRIDE; 53 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; 54 55 AppContextMenuDelegate* delegate_; 56 Profile* profile_; 57 const std::string app_id_; 58 AppListControllerDelegate* controller_; 59 bool is_platform_app_; 60 bool is_search_result_; 61 62 scoped_ptr<ui::SimpleMenuModel> menu_model_; 63 scoped_ptr<extensions::ContextMenuMatcher> extension_menu_items_; 64 65 DISALLOW_COPY_AND_ASSIGN(AppContextMenu); 66}; 67 68} // namespace app_list 69 70#endif // CHROME_BROWSER_UI_APP_LIST_APP_CONTEXT_MENU_H_ 71