app_result.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_SEARCH_APP_RESULT_H_ 6#define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_ 7 8#include <string> 9 10#include "base/memory/scoped_ptr.h" 11#include "chrome/browser/extensions/extension_icon_image.h" 12#include "chrome/browser/ui/app_list/app_context_menu_delegate.h" 13#include "chrome/browser/ui/app_list/search/chrome_search_result.h" 14 15class AppListControllerDelegate; 16class Profile; 17 18namespace app_list { 19 20class AppContextMenu; 21class TokenizedString; 22class TokenizedStringMatch; 23 24class AppResult : public ChromeSearchResult, 25 public extensions::IconImage::Observer, 26 public AppContextMenuDelegate { 27 public: 28 AppResult(Profile* profile, 29 const std::string& app_id, 30 AppListControllerDelegate* controller); 31 virtual ~AppResult(); 32 33 void UpdateFromMatch(const TokenizedString& title, 34 const TokenizedStringMatch& match); 35 36 // ChromeSearchResult overides: 37 virtual void Open(int event_flags) OVERRIDE; 38 virtual void InvokeAction(int action_index, int event_flags) OVERRIDE; 39 virtual scoped_ptr<ChromeSearchResult> Duplicate() OVERRIDE; 40 virtual ui::MenuModel* GetContextMenuModel() OVERRIDE; 41 42 private: 43 // extensions::IconImage::Observer overrides: 44 virtual void OnExtensionIconImageChanged( 45 extensions::IconImage* image) OVERRIDE; 46 47 // AppContextMenuDelegate overrides: 48 virtual void ExecuteLaunchCommand(int event_flags) OVERRIDE; 49 50 Profile* profile_; 51 const std::string app_id_; 52 AppListControllerDelegate* controller_; 53 54 bool is_platform_app_; 55 scoped_ptr<extensions::IconImage> icon_; 56 scoped_ptr<AppContextMenu> context_menu_; 57 58 DISALLOW_COPY_AND_ASSIGN(AppResult); 59}; 60 61} // namespace app_list 62 63#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_ 64