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 "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 11 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 class ImageSkia; | 18 class ImageSkia; |
19 } | 19 } |
20 | 20 |
21 namespace extensions { | 21 namespace extensions { |
22 | 22 |
23 class ExtensionPrefs; | 23 class ExtensionPrefs; |
24 | 24 |
25 class InstallTracker : public ProfileKeyedService, | 25 class InstallTracker : public BrowserContextKeyedService, |
26 public content::NotificationObserver { | 26 public content::NotificationObserver { |
27 public: | 27 public: |
28 InstallTracker(Profile* profile, | 28 InstallTracker(Profile* profile, |
29 extensions::ExtensionPrefs* prefs); | 29 extensions::ExtensionPrefs* prefs); |
30 virtual ~InstallTracker(); | 30 virtual ~InstallTracker(); |
31 | 31 |
32 void AddObserver(InstallObserver* observer); | 32 void AddObserver(InstallObserver* observer); |
33 void RemoveObserver(InstallObserver* observer); | 33 void RemoveObserver(InstallObserver* observer); |
34 | 34 |
35 void OnBeginExtensionInstall( | 35 void OnBeginExtensionInstall( |
36 const std::string& extension_id, | 36 const std::string& extension_id, |
37 const std::string& extension_name, | 37 const std::string& extension_name, |
38 const gfx::ImageSkia& installing_icon, | 38 const gfx::ImageSkia& installing_icon, |
39 bool is_app, | 39 bool is_app, |
40 bool is_platform_app); | 40 bool is_platform_app); |
41 void OnDownloadProgress(const std::string& extension_id, | 41 void OnDownloadProgress(const std::string& extension_id, |
42 int percent_downloaded); | 42 int percent_downloaded); |
43 void OnInstallFailure(const std::string& extension_id); | 43 void OnInstallFailure(const std::string& extension_id); |
44 | 44 |
45 // Overriddes for ProfileKeyedService: | 45 // Overriddes for BrowserContextKeyedService: |
46 virtual void Shutdown() OVERRIDE; | 46 virtual void Shutdown() OVERRIDE; |
47 | 47 |
48 // content::NotificationObserver | 48 // content::NotificationObserver |
49 virtual void Observe(int type, | 49 virtual void Observe(int type, |
50 const content::NotificationSource& source, | 50 const content::NotificationSource& source, |
51 const content::NotificationDetails& details) OVERRIDE; | 51 const content::NotificationDetails& details) OVERRIDE; |
52 | 52 |
53 private: | 53 private: |
54 void OnAppsReordered(); | 54 void OnAppsReordered(); |
55 | 55 |
56 ObserverList<InstallObserver> observers_; | 56 ObserverList<InstallObserver> observers_; |
57 content::NotificationRegistrar registrar_; | 57 content::NotificationRegistrar registrar_; |
58 PrefChangeRegistrar pref_change_registrar_; | 58 PrefChangeRegistrar pref_change_registrar_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(InstallTracker); | 60 DISALLOW_COPY_AND_ASSIGN(InstallTracker); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace extensions | 63 } // namespace extensions |
64 | 64 |
65 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ | 65 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ |
OLD | NEW |