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 // TODO(khmel): this is not Launcher class. Consider moving this to proper |
14 class ExtensionSet; | 14 // place. |
15 } // namespace extensions | |
16 | |
17 class LauncherExtensionAppUpdater | 15 class LauncherExtensionAppUpdater |
18 : public LauncherAppUpdater, | 16 : public LauncherAppUpdater, |
19 public extensions::ExtensionRegistryObserver, | 17 public extensions::ExtensionRegistryObserver, |
20 public ArcAppListPrefs::Observer { | 18 public ArcAppListPrefs::Observer { |
21 public: | 19 public: |
22 LauncherExtensionAppUpdater(Delegate* delegate, | 20 LauncherExtensionAppUpdater(Delegate* delegate, |
23 content::BrowserContext* browser_context); | 21 content::BrowserContext* browser_context); |
24 ~LauncherExtensionAppUpdater() override; | 22 ~LauncherExtensionAppUpdater() override; |
25 | 23 |
26 // ExtensionRegistryObserver: | 24 // ExtensionRegistryObserver: |
27 void OnExtensionLoaded(content::BrowserContext* browser_context, | 25 void OnExtensionLoaded(content::BrowserContext* browser_context, |
28 const extensions::Extension* extension) override; | 26 const extensions::Extension* extension) override; |
29 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 27 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
30 const extensions::Extension* extension, | 28 const extensions::Extension* extension, |
31 extensions::UnloadedExtensionReason reason) override; | 29 extensions::UnloadedExtensionReason reason) override; |
32 void OnExtensionUninstalled(content::BrowserContext* browser_context, | 30 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
33 const extensions::Extension* extension, | 31 const extensions::Extension* extension, |
34 extensions::UninstallReason reason) override; | 32 extensions::UninstallReason reason) override; |
35 void OnShutdown(extensions::ExtensionRegistry* registry) override; | 33 void OnShutdown(extensions::ExtensionRegistry* registry) override; |
36 | 34 |
37 // ArcAppListPrefs::Observer | 35 // ArcAppListPrefs::Observer |
38 void OnPackageInstalled( | 36 void OnPackageInstalled( |
39 const arc::mojom::ArcPackageInfo& package_info) override; | 37 const arc::mojom::ArcPackageInfo& package_info) override; |
40 void OnPackageRemoved(const std::string& package_name) override; | 38 void OnPackageRemoved(const std::string& package_name, |
| 39 bool uninstalled) override; |
| 40 void OnPackageListInitialRefreshed() override; |
41 | 41 |
42 private: | 42 private: |
43 void StartObservingExtensionRegistry(); | 43 void StartObservingExtensionRegistry(); |
44 void StopObservingExtensionRegistry(); | 44 void StopObservingExtensionRegistry(); |
45 | 45 |
46 void UpdateHostedApps(); | 46 void UpdateApp(const std::string& app_id); |
47 void UpdateHostedApps(const extensions::ExtensionSet& extensions); | 47 void UpdateEquivalentApp(const std::string& arc_package_name); |
48 void UpdateHostedApp(const std::string& app_id); | |
49 void UpdateEquivalentHostedApp(const std::string& arc_package_name); | |
50 | 48 |
51 extensions::ExtensionRegistry* extension_registry_ = nullptr; | 49 extensions::ExtensionRegistry* extension_registry_ = nullptr; |
52 | 50 |
53 DISALLOW_COPY_AND_ASSIGN(LauncherExtensionAppUpdater); | 51 DISALLOW_COPY_AND_ASSIGN(LauncherExtensionAppUpdater); |
54 }; | 52 }; |
55 | 53 |
56 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ | 54 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ |
OLD | NEW |