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/keyed_service/core/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 extensions { | 17 namespace extensions { |
18 | 18 |
19 class ExtensionPrefs; | 19 class ExtensionPrefs; |
20 | 20 |
21 class InstallTracker : public BrowserContextKeyedService, | 21 class InstallTracker : public KeyedService, |
22 public content::NotificationObserver { | 22 public content::NotificationObserver { |
23 public: | 23 public: |
24 InstallTracker(Profile* profile, | 24 InstallTracker(Profile* profile, |
25 extensions::ExtensionPrefs* prefs); | 25 extensions::ExtensionPrefs* prefs); |
26 virtual ~InstallTracker(); | 26 virtual ~InstallTracker(); |
27 | 27 |
28 void AddObserver(InstallObserver* observer); | 28 void AddObserver(InstallObserver* observer); |
29 void RemoveObserver(InstallObserver* observer); | 29 void RemoveObserver(InstallObserver* observer); |
30 | 30 |
31 void OnBeginExtensionInstall( | 31 void OnBeginExtensionInstall( |
32 const InstallObserver::ExtensionInstallParams& params); | 32 const InstallObserver::ExtensionInstallParams& params); |
33 void OnDownloadProgress(const std::string& extension_id, | 33 void OnDownloadProgress(const std::string& extension_id, |
34 int percent_downloaded); | 34 int percent_downloaded); |
35 void OnInstallFailure(const std::string& extension_id); | 35 void OnInstallFailure(const std::string& extension_id); |
36 | 36 |
37 // Overriddes for BrowserContextKeyedService: | 37 // Overriddes for KeyedService: |
38 virtual void Shutdown() OVERRIDE; | 38 virtual void Shutdown() OVERRIDE; |
39 | 39 |
40 // content::NotificationObserver | 40 // content::NotificationObserver |
41 virtual void Observe(int type, | 41 virtual void Observe(int type, |
42 const content::NotificationSource& source, | 42 const content::NotificationSource& source, |
43 const content::NotificationDetails& details) OVERRIDE; | 43 const content::NotificationDetails& details) OVERRIDE; |
44 | 44 |
45 private: | 45 private: |
46 void OnAppsReordered(); | 46 void OnAppsReordered(); |
47 | 47 |
48 ObserverList<InstallObserver> observers_; | 48 ObserverList<InstallObserver> observers_; |
49 content::NotificationRegistrar registrar_; | 49 content::NotificationRegistrar registrar_; |
50 PrefChangeRegistrar pref_change_registrar_; | 50 PrefChangeRegistrar pref_change_registrar_; |
51 | 51 |
52 DISALLOW_COPY_AND_ASSIGN(InstallTracker); | 52 DISALLOW_COPY_AND_ASSIGN(InstallTracker); |
53 }; | 53 }; |
54 | 54 |
55 } // namespace extensions | 55 } // namespace extensions |
56 | 56 |
57 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ | 57 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ |
OLD | NEW |