#include "chrome/browser/web_applications/jobs/uninstall/web_app_uninstall_and_replace_job.h"
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "build/build_config.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/commands/set_user_display_mode_command.h"
#include "chrome/browser/web_applications/extensions/web_app_extension_shortcut.h"
#include "chrome/browser/web_applications/locks/with_app_resources.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/os_integration/os_integration_manager.h"
#include "chrome/browser/web_applications/os_integration/os_integration_sub_manager.h"
#include "chrome/browser/web_applications/os_integration/web_app_shortcut.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_registry_update.h"
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "chrome/browser/web_applications/web_app_ui_manager.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/app_update.h"
#include "components/services/app_service/public/cpp/types_util.h"
#include "extensions/browser/app_sorting.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
namespace web_app {
namespace {
bool IsAppInstalled(Profile* profile, const webapps::AppId& app_id) { … }
mojom::UserDisplayMode GetExtensionUserDisplayMode(
Profile* profile,
const extensions::Extension* extension) { … }
}
WebAppUninstallAndReplaceJob::WebAppUninstallAndReplaceJob(
Profile* profile,
base::Value::Dict& debug_value,
WithAppResources& to_app_lock,
const std::vector<webapps::AppId>& from_apps_or_extensions,
const webapps::AppId& to_app,
base::OnceCallback<void(bool uninstall_triggered)> on_complete)
: … { … }
WebAppUninstallAndReplaceJob::~WebAppUninstallAndReplaceJob() = default;
void WebAppUninstallAndReplaceJob::Start() { … }
void WebAppUninstallAndReplaceJob::MigrateUiAndUninstallApp(
const webapps::AppId& from_app,
base::OnceClosure on_complete) { … }
void WebAppUninstallAndReplaceJob::OnMigrateLauncherState(
const webapps::AppId& from_app,
base::OnceClosure on_complete) { … }
void WebAppUninstallAndReplaceJob::
OnShortcutInfoReceivedSearchShortcutLocations(
const webapps::AppId& from_app,
base::OnceClosure on_complete,
std::unique_ptr<ShortcutInfo> shortcut_info) { … }
void WebAppUninstallAndReplaceJob::OnShortcutLocationGathered(
const webapps::AppId& from_app,
base::OnceClosure on_complete,
ShortcutLocations from_app_locations) { … }
void WebAppUninstallAndReplaceJob::SynchronizeOSIntegrationForReplacementApp(
base::OnceClosure on_complete,
bool from_app_run_on_os_login,
ShortcutLocations from_app_locations) { … }
}