#include "chrome/browser/web_applications/isolated_web_apps/install_isolated_web_app_command.h"
#include <memory>
#include <optional>
#include <ostream>
#include <string>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/containers/to_vector.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/sequence_checker.h"
#include "base/strings/to_string.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/callback_utils.h"
#include "chrome/browser/web_applications/commands/web_app_command.h"
#include "chrome/browser/web_applications/isolated_web_apps/error/uma_logging.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_install_command_helper.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_install_source.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_integrity_block_data.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_storage_location.h"
#include "chrome/browser/web_applications/locks/app_lock.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_install_finalizer.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_install_utils.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "chrome/browser/web_applications/web_contents/web_contents_manager.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_id.h"
#include "components/webapps/browser/install_result_code.h"
#include "components/webapps/browser/installable/installable_logging.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "components/webapps/browser/web_contents/web_app_url_loader.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
namespace web_app {
InstallIsolatedWebAppCommandSuccess::InstallIsolatedWebAppCommandSuccess(
base::Version installed_version,
IsolatedWebAppStorageLocation location)
: … { … }
InstallIsolatedWebAppCommandSuccess::~InstallIsolatedWebAppCommandSuccess() =
default;
InstallIsolatedWebAppCommandSuccess::InstallIsolatedWebAppCommandSuccess(
const InstallIsolatedWebAppCommandSuccess& other) = default;
std::ostream& operator<<(std::ostream& os,
const InstallIsolatedWebAppCommandSuccess& success) { … }
std::ostream& operator<<(std::ostream& os,
const InstallIsolatedWebAppCommandError& error) { … }
InstallIsolatedWebAppCommand::InstallIsolatedWebAppCommand(
const IsolatedWebAppUrlInfo& url_info,
const IsolatedWebAppInstallSource& install_source,
const std::optional<base::Version>& expected_version,
std::unique_ptr<content::WebContents> web_contents,
std::unique_ptr<ScopedKeepAlive> optional_keep_alive,
std::unique_ptr<ScopedProfileKeepAlive> optional_profile_keep_alive,
base::OnceCallback<void(base::expected<InstallIsolatedWebAppCommandSuccess,
InstallIsolatedWebAppCommandError>)>
callback,
std::unique_ptr<IsolatedWebAppInstallCommandHelper> command_helper)
: … { … }
InstallIsolatedWebAppCommand::~InstallIsolatedWebAppCommand() { … }
void InstallIsolatedWebAppCommand::StartWithLock(
std::unique_ptr<AppLock> lock) { … }
void InstallIsolatedWebAppCommand::CopyToProfileDirectory(
base::OnceClosure next_step_callback) { … }
void InstallIsolatedWebAppCommand::OnCopiedToProfileDirectory(
base::OnceClosure next_step_callback,
base::expected<IsolatedWebAppStorageLocation, std::string> new_location) { … }
void InstallIsolatedWebAppCommand::CheckTrustAndSignatures(
base::OnceCallback<
void(std::optional<web_package::SignedWebBundleIntegrityBlock>)>
next_step_callback) { … }
void InstallIsolatedWebAppCommand::CreateStoragePartition(
base::OnceClosure next_step_callback,
std::optional<web_package::SignedWebBundleIntegrityBlock> integrity_block) { … }
void InstallIsolatedWebAppCommand::LoadInstallUrl(
base::OnceClosure next_step_callback) { … }
void InstallIsolatedWebAppCommand::CheckInstallabilityAndRetrieveManifest(
base::OnceCallback<void(blink::mojom::ManifestPtr)> next_step_callback) { … }
void InstallIsolatedWebAppCommand::ValidateManifestAndCreateInstallInfo(
base::OnceCallback<void(WebAppInstallInfo)> next_step_callback,
blink::mojom::ManifestPtr manifest) { … }
void InstallIsolatedWebAppCommand::RetrieveIconsAndPopulateInstallInfo(
base::OnceCallback<void(WebAppInstallInfo)> next_step_callback,
WebAppInstallInfo install_info) { … }
void InstallIsolatedWebAppCommand::FinalizeInstall(WebAppInstallInfo info) { … }
void InstallIsolatedWebAppCommand::OnFinalizeInstall(
const webapps::AppId& unused_app_id,
webapps::InstallResultCode install_result_code) { … }
void InstallIsolatedWebAppCommand::ReportFailure(InstallIwaError error,
std::string_view message) { … }
void InstallIsolatedWebAppCommand::ReportSuccess() { … }
Profile& InstallIsolatedWebAppCommand::profile() { … }
}