OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
10 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" | 10 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" |
11 #include "extensions/browser/extension_registry_observer.h" | 11 #include "extensions/browser/extension_registry_observer.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 class ExtensionSet; | 14 class ExtensionSet; |
15 } // namespace extensions | 15 } // namespace extensions |
16 | 16 |
| 17 // TODO (khmel), this is not Launcher class. Consider moving this to proper |
| 18 // place. |
17 class LauncherExtensionAppUpdater | 19 class LauncherExtensionAppUpdater |
18 : public LauncherAppUpdater, | 20 : public LauncherAppUpdater, |
19 public extensions::ExtensionRegistryObserver, | 21 public extensions::ExtensionRegistryObserver, |
20 public ArcAppListPrefs::Observer { | 22 public ArcAppListPrefs::Observer { |
21 public: | 23 public: |
22 LauncherExtensionAppUpdater(Delegate* delegate, | 24 LauncherExtensionAppUpdater(Delegate* delegate, |
23 content::BrowserContext* browser_context); | 25 content::BrowserContext* browser_context); |
24 ~LauncherExtensionAppUpdater() override; | 26 ~LauncherExtensionAppUpdater() override; |
25 | 27 |
26 // ExtensionRegistryObserver: | 28 // ExtensionRegistryObserver: |
27 void OnExtensionLoaded(content::BrowserContext* browser_context, | 29 void OnExtensionLoaded(content::BrowserContext* browser_context, |
28 const extensions::Extension* extension) override; | 30 const extensions::Extension* extension) override; |
29 void OnExtensionUnloaded( | 31 void OnExtensionUnloaded( |
30 content::BrowserContext* browser_context, | 32 content::BrowserContext* browser_context, |
31 const extensions::Extension* extension, | 33 const extensions::Extension* extension, |
32 extensions::UnloadedExtensionInfo::Reason reason) override; | 34 extensions::UnloadedExtensionInfo::Reason reason) override; |
33 void OnExtensionUninstalled(content::BrowserContext* browser_context, | 35 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
34 const extensions::Extension* extension, | 36 const extensions::Extension* extension, |
35 extensions::UninstallReason reason) override; | 37 extensions::UninstallReason reason) override; |
36 void OnShutdown(extensions::ExtensionRegistry* registry) override; | 38 void OnShutdown(extensions::ExtensionRegistry* registry) override; |
37 | 39 |
38 // ArcAppListPrefs::Observer | 40 // ArcAppListPrefs::Observer |
39 void OnPackageInstalled( | 41 void OnPackageInstalled( |
40 const arc::mojom::ArcPackageInfo& package_info) override; | 42 const arc::mojom::ArcPackageInfo& package_info) override; |
41 void OnPackageRemoved(const std::string& package_name) override; | 43 void OnPackageRemoved(const std::string& package_name, |
| 44 bool uninstalled) override; |
42 | 45 |
43 private: | 46 private: |
44 void StartObservingExtensionRegistry(); | 47 void StartObservingExtensionRegistry(); |
45 void StopObservingExtensionRegistry(); | 48 void StopObservingExtensionRegistry(); |
46 | 49 |
47 void UpdateHostedApps(); | 50 void UpdateHostedApps(); |
48 void UpdateHostedApps(const extensions::ExtensionSet& extensions); | 51 void UpdateHostedApps(const extensions::ExtensionSet& extensions); |
49 void UpdateHostedApp(const std::string& app_id); | 52 void UpdateHostedApp(const std::string& app_id); |
50 void UpdateEquivalentHostedApp(const std::string& arc_package_name); | 53 void UpdateEquivalentHostedApp(const std::string& arc_package_name); |
51 | 54 |
52 extensions::ExtensionRegistry* extension_registry_ = nullptr; | 55 extensions::ExtensionRegistry* extension_registry_ = nullptr; |
53 | 56 |
54 DISALLOW_COPY_AND_ASSIGN(LauncherExtensionAppUpdater); | 57 DISALLOW_COPY_AND_ASSIGN(LauncherExtensionAppUpdater); |
55 }; | 58 }; |
56 | 59 |
57 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ | 60 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ |
OLD | NEW |