| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ |
| 7 | 7 |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "base/prefs/pref_change_registrar.h" | 9 #include "base/prefs/pref_change_registrar.h" |
| 10 #include "chrome/browser/extensions/install_observer.h" | 10 #include "chrome/browser/extensions/install_observer.h" |
| 11 #include "chrome/browser/ui/app_list/app_list_extension_sorting_observer.h" |
| 11 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 12 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 14 | 15 |
| 16 class AppListExtensionSorting; |
| 15 class Profile; | 17 class Profile; |
| 16 | 18 |
| 17 namespace gfx { | 19 namespace gfx { |
| 18 class ImageSkia; | 20 class ImageSkia; |
| 19 } | 21 } |
| 20 | 22 |
| 21 namespace extensions { | 23 namespace extensions { |
| 22 | 24 |
| 23 class ExtensionPrefs; | 25 class ExtensionPrefs; |
| 24 | 26 |
| 25 class InstallTracker : public BrowserContextKeyedService, | 27 class InstallTracker : public BrowserContextKeyedService, |
| 26 public content::NotificationObserver { | 28 public content::NotificationObserver, |
| 29 public AppListExtensionSortingObserver { |
| 27 public: | 30 public: |
| 28 InstallTracker(Profile* profile, | 31 InstallTracker(Profile* profile, |
| 29 extensions::ExtensionPrefs* prefs); | 32 extensions::ExtensionPrefs* prefs); |
| 30 virtual ~InstallTracker(); | 33 virtual ~InstallTracker(); |
| 31 | 34 |
| 32 void AddObserver(InstallObserver* observer); | 35 void AddObserver(InstallObserver* observer); |
| 33 void RemoveObserver(InstallObserver* observer); | 36 void RemoveObserver(InstallObserver* observer); |
| 34 | 37 |
| 35 void OnBeginExtensionInstall( | 38 void OnBeginExtensionInstall( |
| 36 const std::string& extension_id, | 39 const std::string& extension_id, |
| 37 const std::string& extension_name, | 40 const std::string& extension_name, |
| 38 const gfx::ImageSkia& installing_icon, | 41 const gfx::ImageSkia& installing_icon, |
| 39 bool is_app, | 42 bool is_app, |
| 40 bool is_platform_app); | 43 bool is_platform_app); |
| 41 void OnDownloadProgress(const std::string& extension_id, | 44 void OnDownloadProgress(const std::string& extension_id, |
| 42 int percent_downloaded); | 45 int percent_downloaded); |
| 43 void OnInstallFailure(const std::string& extension_id); | 46 void OnInstallFailure(const std::string& extension_id); |
| 44 | 47 |
| 45 // Overriddes for BrowserContextKeyedService: | 48 // Overrides for BrowserContextKeyedService: |
| 46 virtual void Shutdown() OVERRIDE; | 49 virtual void Shutdown() OVERRIDE; |
| 47 | 50 |
| 48 // content::NotificationObserver | 51 // Overrides for content::NotificationObserver: |
| 49 virtual void Observe(int type, | 52 virtual void Observe(int type, |
| 50 const content::NotificationSource& source, | 53 const content::NotificationSource& source, |
| 51 const content::NotificationDetails& details) OVERRIDE; | 54 const content::NotificationDetails& details) OVERRIDE; |
| 52 | 55 |
| 56 // Overrides for AppListExtensionSortingObserver: |
| 57 virtual void OnAppListReordered() OVERRIDE; |
| 58 |
| 53 private: | 59 private: |
| 54 void OnAppsReordered(); | 60 void ExtensionPrefsChanged(); |
| 55 | 61 |
| 62 AppListExtensionSorting* app_list_extension_sorting_; |
| 56 ObserverList<InstallObserver> observers_; | 63 ObserverList<InstallObserver> observers_; |
| 57 content::NotificationRegistrar registrar_; | 64 content::NotificationRegistrar registrar_; |
| 58 PrefChangeRegistrar pref_change_registrar_; | 65 PrefChangeRegistrar pref_change_registrar_; |
| 59 | 66 |
| 60 DISALLOW_COPY_AND_ASSIGN(InstallTracker); | 67 DISALLOW_COPY_AND_ASSIGN(InstallTracker); |
| 61 }; | 68 }; |
| 62 | 69 |
| 63 } // namespace extensions | 70 } // namespace extensions |
| 64 | 71 |
| 65 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ | 72 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ |
| OLD | NEW |