#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_
#define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_
#include <string>
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_icon_image.h"
#include "chrome/browser/extensions/install_observer.h"
#include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
class AppListControllerDelegate;
class ExtensionEnableFlow;
class Profile;
namespace extensions {
class InstallTracker;
}
namespace app_list {
class AppContextMenu;
class TokenizedString;
class TokenizedStringMatch;
class AppResult : public ChromeSearchResult,
public extensions::IconImage::Observer,
public AppContextMenuDelegate,
public ExtensionEnableFlowDelegate,
public extensions::InstallObserver {
public:
AppResult(Profile* profile,
const std::string& app_id,
AppListControllerDelegate* controller);
virtual ~AppResult();
void UpdateFromMatch(const TokenizedString& title,
const TokenizedStringMatch& match);
virtual void Open(int event_flags) OVERRIDE;
virtual void InvokeAction(int action_index, int event_flags) OVERRIDE;
virtual scoped_ptr<ChromeSearchResult> Duplicate() OVERRIDE;
virtual ui::MenuModel* GetContextMenuModel() OVERRIDE;
virtual ChromeSearchResultType GetType() OVERRIDE;
private:
void StartObservingInstall();
void StopObservingInstall();
bool RunExtensionEnableFlow();
void UpdateIcon();
virtual void OnExtensionIconImageChanged(
extensions::IconImage* image) OVERRIDE;
virtual void ExecuteLaunchCommand(int event_flags) OVERRIDE;
virtual void ExtensionEnableFlowFinished() OVERRIDE;
virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE;
virtual void OnExtensionLoaded(
const extensions::Extension* extension) OVERRIDE;
virtual void OnExtensionUninstalled(
const extensions::Extension* extension) OVERRIDE;
virtual void OnShutdown() OVERRIDE;
Profile* profile_;
const std::string app_id_;
AppListControllerDelegate* controller_;
bool is_platform_app_;
scoped_ptr<extensions::IconImage> icon_;
scoped_ptr<AppContextMenu> context_menu_;
scoped_ptr<ExtensionEnableFlow> extension_enable_flow_;
extensions::InstallTracker* install_tracker_;
DISALLOW_COPY_AND_ASSIGN(AppResult);
};
}
#endif