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_RECOMMENDED_APPS_H_
6 #define CHROME_BROWSER_UI_APP_LIST_RECOMMENDED_APPS_H_
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/observer_list.h"
13 #include "base/prefs/pref_change_registrar.h"
14 #include "base/scoped_observer.h"
15 #include "extensions/browser/extension_registry_observer.h"
19 namespace extensions {
20 class ExtensionRegistry;
25 class RecommendedAppsObserver;
27 // A class that maintains a list of recommended apps by watching changes
29 class RecommendedApps : public extensions::ExtensionRegistryObserver {
31 typedef std::vector<scoped_refptr<const extensions::Extension> > Apps;
33 explicit RecommendedApps(Profile* profile);
34 ~RecommendedApps() override;
36 void AddObserver(RecommendedAppsObserver* observer);
37 void RemoveObserver(RecommendedAppsObserver* observer);
39 const Apps& apps() const { return apps_; }
44 // extensions::ExtensionRegistryObserver overrides:
45 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
46 const extensions::Extension* extension,
49 const std::string& old_name) override;
50 void OnExtensionLoaded(content::BrowserContext* browser_context,
51 const extensions::Extension* extension) override;
52 void OnExtensionUnloaded(
53 content::BrowserContext* browser_context,
54 const extensions::Extension* extension,
55 extensions::UnloadedExtensionInfo::Reason reason) override;
56 void OnExtensionUninstalled(content::BrowserContext* browser_context,
57 const extensions::Extension* extension,
58 extensions::UninstallReason reason) override;
61 PrefChangeRegistrar pref_change_registrar_;
64 ObserverList<RecommendedAppsObserver, true> observers_;
66 ScopedObserver<extensions::ExtensionRegistry,
67 extensions::ExtensionRegistryObserver>
68 extension_registry_observer_;
70 DISALLOW_COPY_AND_ASSIGN(RecommendedApps);
73 } // namespace app_list
75 #endif // CHROME_BROWSER_UI_APP_LIST_RECOMMENDED_APPS_H_