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.
5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_RESULT_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_RESULT_H_
10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/extensions/install_observer.h"
13 #include "chrome/browser/ui/app_list/search/chrome_search_result.h"
16 class AppListControllerDelegate
;
19 namespace extensions
{
25 class WebstoreResult
: public ChromeSearchResult
,
26 public extensions::InstallObserver
{
28 WebstoreResult(Profile
* profile
,
29 const std::string
& app_id
,
30 const std::string
& localized_name
,
32 AppListControllerDelegate
* controller
);
33 virtual ~WebstoreResult();
35 // ChromeSearchResult overides:
36 virtual void Open(int event_flags
) OVERRIDE
;
37 virtual void InvokeAction(int action_index
, int event_flags
) OVERRIDE
;
38 virtual scoped_ptr
<ChromeSearchResult
> Duplicate() OVERRIDE
;
39 virtual ChromeSearchResultType
GetType() OVERRIDE
;
43 void SetDefaultDetails();
47 void InstallCallback(bool success
, const std::string
& error
);
49 void StartObservingInstall();
50 void StopObservingInstall();
52 // extensions::InstallObserver overrides:
53 virtual void OnBeginExtensionInstall(const std::string
& extension_id
,
54 const std::string
& extension_name
,
55 const gfx::ImageSkia
& installing_icon
,
57 bool is_platform_app
) OVERRIDE
;
58 virtual void OnDownloadProgress(const std::string
& extension_id
,
59 int percent_downloaded
) OVERRIDE
;
60 virtual void OnInstallFailure(const std::string
& extension_id
) OVERRIDE
;
61 virtual void OnExtensionInstalled(
62 const extensions::Extension
* extension
) OVERRIDE
;
63 virtual void OnExtensionLoaded(
64 const extensions::Extension
* extension
) OVERRIDE
;
65 virtual void OnExtensionUnloaded(
66 const extensions::Extension
* extension
) OVERRIDE
;
67 virtual void OnExtensionUninstalled(
68 const extensions::Extension
* extension
) OVERRIDE
;
69 virtual void OnAppsReordered() OVERRIDE
;
70 virtual void OnAppInstalledToAppList(
71 const std::string
& extension_id
) OVERRIDE
;
72 virtual void OnShutdown() OVERRIDE
;
75 const std::string app_id_
;
76 const std::string localized_name_
;
80 base::WeakPtrFactory
<WebstoreResult
> weak_factory_
;
82 AppListControllerDelegate
* controller_
;
83 extensions::InstallTracker
* install_tracker_
; // Not owned.
85 DISALLOW_COPY_AND_ASSIGN(WebstoreResult
);
88 } // namespace app_list
90 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_RESULT_H_