diff --git a/chrome/browser/apps/app_service/publishers/arc_apps.cc b/chrome/browser/apps/app_service/publishers/arc_apps.cc index ec7927ed4c41c..fbd795522812b 100644 --- a/chrome/browser/apps/app_service/publishers/arc_apps.cc +++ b/chrome/browser/apps/app_service/publishers/arc_apps.cc @@ -49,7 +49,6 @@ #include "components/app_restore/full_restore_save_handler.h" #include "components/app_restore/full_restore_utils.h" #include "components/arc/common/intent_helper/arc_intent_helper_package.h" -#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/icon_types.h" #include "components/services/app_service/public/cpp/intent.h" #include "components/services/app_service/public/cpp/intent_filter.h" @@ -1016,6 +1015,13 @@ void ArcApps::SetPermission(const std::string& app_id, } } +void ArcApps::Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + bool clear_site_data, + bool report_abuse) { + arc::UninstallArcApp(app_id, profile_); +} + void ArcApps::OnPreferredAppSet( const std::string& app_id, IntentFilterPtr intent_filter, diff --git a/chrome/browser/apps/app_service/publishers/arc_apps.h b/chrome/browser/apps/app_service/publishers/arc_apps.h index e9cf7d64a2005..c495b12719b0f 100644 --- a/chrome/browser/apps/app_service/publishers/arc_apps.h +++ b/chrome/browser/apps/app_service/publishers/arc_apps.h @@ -37,6 +37,7 @@ #include "components/arc/intent_helper/arc_intent_helper_observer.h" #include "components/keyed_service/core/keyed_service.h" #include "components/services/app_service/public/cpp/app_launch_util.h" +#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/instance_registry.h" #include "components/services/app_service/public/cpp/intent.h" #include "components/services/app_service/public/cpp/permission.h" @@ -124,6 +125,10 @@ class ArcApps : public KeyedService, int64_t display_id) override; void SetPermission(const std::string& app_id, PermissionPtr permission) override; + void Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + bool clear_site_data, + bool report_abuse); void OnPreferredAppSet( const std::string& app_id, IntentFilterPtr intent_filter, diff --git a/chrome/browser/apps/app_service/publishers/borealis_apps.cc b/chrome/browser/apps/app_service/publishers/borealis_apps.cc index 99a8a9bee7b0f..f3ea5821780bc 100644 --- a/chrome/browser/apps/app_service/publishers/borealis_apps.cc +++ b/chrome/browser/apps/app_service/publishers/borealis_apps.cc @@ -24,7 +24,6 @@ #include "chrome/grit/chrome_unscaled_resources.h" #include "chrome/grit/generated_resources.h" #include "components/prefs/pref_service.h" -#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/permission_utils.h" #include "components/services/app_service/public/cpp/publisher_base.h" #include "ui/base/l10n/l10n_util.h" @@ -343,6 +342,15 @@ void BorealisApps::SetPermission(const std::string& app_id, permission_ptr->IsPermissionEnabled()); } +void BorealisApps::Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + bool clear_site_data, + bool report_abuse) { + borealis::BorealisService::GetForProfile(profile_) + ->AppUninstaller() + .Uninstall(app_id, base::DoNothing()); +} + void BorealisApps::Connect( mojo::PendingRemote subscriber_remote, apps::mojom::ConnectOptionsPtr opts) { diff --git a/chrome/browser/apps/app_service/publishers/borealis_apps.h b/chrome/browser/apps/app_service/publishers/borealis_apps.h index c794a3a97c681..8de78b90c8818 100644 --- a/chrome/browser/apps/app_service/publishers/borealis_apps.h +++ b/chrome/browser/apps/app_service/publishers/borealis_apps.h @@ -17,6 +17,7 @@ #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "components/prefs/pref_change_registrar.h" #include "components/services/app_service/public/cpp/app_launch_util.h" +#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/permission.h" #include "components/services/app_service/public/cpp/publisher_base.h" #include "components/services/app_service/public/mojom/app_service.mojom.h" @@ -86,6 +87,10 @@ class BorealisApps LaunchCallback callback) override; void SetPermission(const std::string& app_id, PermissionPtr permission) override; + void Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + bool clear_site_data, + bool report_abuse); // apps::PublisherBase overrides. void Connect(mojo::PendingRemote subscriber_remote, diff --git a/chrome/browser/apps/app_service/publishers/crostini_apps.cc b/chrome/browser/apps/app_service/publishers/crostini_apps.cc index 14d0c83eebb9c..dc873f195b599 100644 --- a/chrome/browser/apps/app_service/publishers/crostini_apps.cc +++ b/chrome/browser/apps/app_service/publishers/crostini_apps.cc @@ -26,7 +26,6 @@ #include "chrome/grit/chrome_unscaled_resources.h" #include "chrome/grit/generated_resources.h" #include "components/prefs/pref_service.h" -#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/intent.h" #include "components/services/app_service/public/cpp/intent_filter.h" #include "components/services/app_service/public/cpp/intent_util.h" @@ -176,6 +175,14 @@ void CrostiniApps::LaunchAppWithParams(AppLaunchParams&& params, std::move(callback).Run(LaunchResult()); } +void CrostiniApps::Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + bool clear_site_data, + bool report_abuse) { + crostini::CrostiniPackageService::GetForProfile(profile_) + ->QueueUninstallApplication(app_id); +} + void CrostiniApps::Connect( mojo::PendingRemote subscriber_remote, apps::mojom::ConnectOptionsPtr opts) { diff --git a/chrome/browser/apps/app_service/publishers/crostini_apps.h b/chrome/browser/apps/app_service/publishers/crostini_apps.h index 5e9ed2063abe5..b264a9a571daf 100644 --- a/chrome/browser/apps/app_service/publishers/crostini_apps.h +++ b/chrome/browser/apps/app_service/publishers/crostini_apps.h @@ -18,6 +18,7 @@ #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "components/keyed_service/core/keyed_service.h" #include "components/services/app_service/public/cpp/app_launch_util.h" +#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/publisher_base.h" #include "components/services/app_service/public/mojom/app_service.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -74,6 +75,10 @@ class CrostiniApps : public KeyedService, base::OnceCallback callback) override; void LaunchAppWithParams(AppLaunchParams&& params, LaunchCallback callback) override; + void Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + bool clear_site_data, + bool report_abuse); // apps::mojom::Publisher overrides. void Connect(mojo::PendingRemote subscriber_remote, diff --git a/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc b/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc index 1421e0b967d8f..bad26492d2f87 100644 --- a/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc +++ b/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc @@ -290,6 +290,17 @@ void PluginVmApps::SetPermission(const std::string& app_id, permission_ptr->IsPermissionEnabled()); } +void PluginVmApps::Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + bool clear_site_data, + bool report_abuse) { + guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile_) + ->ClearApplicationList(guest_os::VmType::PLUGIN_VM, + plugin_vm::kPluginVmName, ""); + plugin_vm::PluginVmManagerFactory::GetForProfile(profile_) + ->UninstallPluginVm(); +} + void PluginVmApps::Launch(const std::string& app_id, int32_t event_flags, apps::mojom::LaunchSource launch_source, diff --git a/chrome/browser/apps/app_service/publishers/plugin_vm_apps.h b/chrome/browser/apps/app_service/publishers/plugin_vm_apps.h index 1d91500a4a427..17c7f420dfb48 100644 --- a/chrome/browser/apps/app_service/publishers/plugin_vm_apps.h +++ b/chrome/browser/apps/app_service/publishers/plugin_vm_apps.h @@ -16,6 +16,7 @@ #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" #include "components/prefs/pref_change_registrar.h" #include "components/services/app_service/public/cpp/app_launch_util.h" +#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/permission.h" #include "components/services/app_service/public/cpp/publisher_base.h" #include "components/services/app_service/public/mojom/app_service.mojom.h" @@ -69,6 +70,10 @@ class PluginVmApps : public apps::PublisherBase, LaunchCallback callback) override; void SetPermission(const std::string& app_id, PermissionPtr permission) override; + void Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + bool clear_site_data, + bool report_abuse); // apps::PublisherBase overrides. void Connect(mojo::PendingRemote subscriber_remote, diff --git a/components/services/app_service/public/cpp/app_types.h b/components/services/app_service/public/cpp/app_types.h index bcbf1d2aa220b..f87f97e87a238 100644 --- a/components/services/app_service/public/cpp/app_types.h +++ b/components/services/app_service/public/cpp/app_types.h @@ -91,6 +91,18 @@ ENUM(InstallSource, kBrowser // Installed from browser. ) +// What caused the app to be uninstalled. +// This should be kept in sync with UninstallSource in enums.xml, so entries +// should not be re-ordered or removed. New entries should be added at the +// bottom. +ENUM(UninstallSource, + kUnknown, + kAppList, // Uninstall by the user from the App List (Launcher) + kAppManagement, // Uninstall by the user from the App Management page + kShelf, // Uninstall by the user from the Shelf + kMigration // Uninstall by app migration. +) + // The window mode that each app will open in. ENUM(WindowMode, kUnknown,