Chromium Code Reviews| 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/chromeos/arc/arc_auth_service.h" | 9 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
|
khmel
2016/11/03 23:10:10
nit: Check if we need this else.
hidehiko
2016/11/04 00:04:56
Done.
| |
| 10 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 10 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 11 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" | 11 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" |
| 12 #include "extensions/browser/extension_registry_observer.h" | 12 #include "extensions/browser/extension_registry_observer.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 class ExtensionSet; | 15 class ExtensionSet; |
| 16 } // namespace extensions | 16 } // namespace extensions |
| 17 | 17 |
| 18 class LauncherExtensionAppUpdater | 18 class LauncherExtensionAppUpdater |
| 19 : public LauncherAppUpdater, | 19 : public LauncherAppUpdater, |
| 20 public extensions::ExtensionRegistryObserver, | 20 public extensions::ExtensionRegistryObserver, |
| 21 public arc::ArcAuthService::Observer, | |
| 22 public ArcAppListPrefs::Observer { | 21 public ArcAppListPrefs::Observer { |
| 23 public: | 22 public: |
| 24 LauncherExtensionAppUpdater(Delegate* delegate, | 23 LauncherExtensionAppUpdater(Delegate* delegate, |
| 25 content::BrowserContext* browser_context); | 24 content::BrowserContext* browser_context); |
| 26 ~LauncherExtensionAppUpdater() override; | 25 ~LauncherExtensionAppUpdater() override; |
| 27 | 26 |
| 28 // ExtensionRegistryObserver: | 27 // ExtensionRegistryObserver: |
| 29 void OnExtensionLoaded(content::BrowserContext* browser_context, | 28 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 30 const extensions::Extension* extension) override; | 29 const extensions::Extension* extension) override; |
| 31 void OnExtensionUnloaded( | 30 void OnExtensionUnloaded( |
| 32 content::BrowserContext* browser_context, | 31 content::BrowserContext* browser_context, |
| 33 const extensions::Extension* extension, | 32 const extensions::Extension* extension, |
| 34 extensions::UnloadedExtensionInfo::Reason reason) override; | 33 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 35 void OnExtensionUninstalled(content::BrowserContext* browser_context, | 34 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
| 36 const extensions::Extension* extension, | 35 const extensions::Extension* extension, |
| 37 extensions::UninstallReason reason) override; | 36 extensions::UninstallReason reason) override; |
| 38 void OnShutdown(extensions::ExtensionRegistry* registry) override; | 37 void OnShutdown(extensions::ExtensionRegistry* registry) override; |
| 39 | 38 |
| 40 // arc::ArcAuthService::Observer: | |
| 41 void OnOptInChanged(arc::ArcAuthService::State state) override; | |
| 42 | |
| 43 // ArcAppListPrefs::Observer | 39 // ArcAppListPrefs::Observer |
| 44 void OnPackageInstalled( | 40 void OnPackageInstalled( |
| 45 const arc::mojom::ArcPackageInfo& package_info) override; | 41 const arc::mojom::ArcPackageInfo& package_info) override; |
| 46 void OnPackageRemoved(const std::string& package_name) override; | 42 void OnPackageRemoved(const std::string& package_name) override; |
| 47 | 43 |
| 48 private: | 44 private: |
| 49 void StartObservingExtensionRegistry(); | 45 void StartObservingExtensionRegistry(); |
| 50 void StopObservingExtensionRegistry(); | 46 void StopObservingExtensionRegistry(); |
| 51 | 47 |
| 52 void UpdateHostedApps(); | 48 void UpdateHostedApps(); |
| 53 void UpdateHostedApps(const extensions::ExtensionSet& extensions); | 49 void UpdateHostedApps(const extensions::ExtensionSet& extensions); |
| 54 void UpdateHostedApp(const std::string& app_id); | 50 void UpdateHostedApp(const std::string& app_id); |
| 55 void UpdateEquivalentHostedApp(const std::string& arc_package_name); | 51 void UpdateEquivalentHostedApp(const std::string& arc_package_name); |
| 56 | 52 |
| 57 extensions::ExtensionRegistry* extension_registry_ = nullptr; | 53 extensions::ExtensionRegistry* extension_registry_ = nullptr; |
| 58 | 54 |
| 59 DISALLOW_COPY_AND_ASSIGN(LauncherExtensionAppUpdater); | 55 DISALLOW_COPY_AND_ASSIGN(LauncherExtensionAppUpdater); |
| 60 }; | 56 }; |
| 61 | 57 |
| 62 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ | 58 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_EXTENSION_APP_UPDATER_H_ |
| OLD | NEW |