| OLD | NEW |
| (Empty) |
| 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_WEBSTORE_RESULT_H_ | |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_RESULT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 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" | |
| 14 #include "url/gurl.h" | |
| 15 | |
| 16 class AppListControllerDelegate; | |
| 17 class Profile; | |
| 18 | |
| 19 namespace extensions { | |
| 20 class InstallTracker; | |
| 21 } | |
| 22 | |
| 23 namespace app_list { | |
| 24 | |
| 25 class WebstoreResult : public ChromeSearchResult, | |
| 26 public extensions::InstallObserver { | |
| 27 public: | |
| 28 WebstoreResult(Profile* profile, | |
| 29 const std::string& app_id, | |
| 30 const std::string& localized_name, | |
| 31 const GURL& icon_url, | |
| 32 AppListControllerDelegate* controller); | |
| 33 virtual ~WebstoreResult(); | |
| 34 | |
| 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; | |
| 40 | |
| 41 private: | |
| 42 void UpdateActions(); | |
| 43 void SetDefaultDetails(); | |
| 44 void OnIconLoaded(); | |
| 45 | |
| 46 void StartInstall(); | |
| 47 void InstallCallback(bool success, const std::string& error); | |
| 48 | |
| 49 void StartObservingInstall(); | |
| 50 void StopObservingInstall(); | |
| 51 | |
| 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, | |
| 56 bool is_app, | |
| 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; | |
| 73 | |
| 74 Profile* profile_; | |
| 75 const std::string app_id_; | |
| 76 const std::string localized_name_; | |
| 77 const GURL icon_url_; | |
| 78 | |
| 79 gfx::ImageSkia icon_; | |
| 80 base::WeakPtrFactory<WebstoreResult> weak_factory_; | |
| 81 | |
| 82 AppListControllerDelegate* controller_; | |
| 83 extensions::InstallTracker* install_tracker_; // Not owned. | |
| 84 | |
| 85 DISALLOW_COPY_AND_ASSIGN(WebstoreResult); | |
| 86 }; | |
| 87 | |
| 88 } // namespace app_list | |
| 89 | |
| 90 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_RESULT_H_ | |
| OLD | NEW |