#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_update_discovery_task.h"
#include <optional>
#include <ostream>
#include "base/containers/to_value_list.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/json/values_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "base/version.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_downloader.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_prepare_and_store_update_command.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_info.h"
#include "chrome/browser/web_applications/isolated_web_apps/update_manifest/update_manifest.h"
#include "chrome/browser/web_applications/isolated_web_apps/update_manifest/update_manifest_fetcher.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "components/keep_alive_registry/keep_alive_types.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/browser/web_contents.h"
#include "net/base/net_errors.h"
namespace web_app {
namespace {
constexpr auto kUpdateManifestFetchTrafficAnnotation = …;
constexpr auto kWebBundleDownloadTrafficAnnotation = …;
}
std::string IsolatedWebAppUpdateDiscoveryTask::SuccessToString(
Success success) { … }
std::string IsolatedWebAppUpdateDiscoveryTask::ErrorToString(Error error) { … }
IsolatedWebAppUpdateDiscoveryTask::IsolatedWebAppUpdateDiscoveryTask(
GURL update_manifest_url,
IsolatedWebAppUrlInfo url_info,
WebAppCommandScheduler& command_scheduler,
WebAppRegistrar& registrar,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
IsolatedWebAppUpdateDiscoveryTask::~IsolatedWebAppUpdateDiscoveryTask() =
default;
void IsolatedWebAppUpdateDiscoveryTask::Start(CompletionCallback callback) { … }
void IsolatedWebAppUpdateDiscoveryTask::OnUpdateManifestFetched(
base::expected<UpdateManifest, UpdateManifestFetcher::Error> fetch_result) { … }
void IsolatedWebAppUpdateDiscoveryTask::CreateTempFile(
UpdateManifest::VersionEntry version_entry) { … }
void IsolatedWebAppUpdateDiscoveryTask::OnTempFileCreated(
UpdateManifest::VersionEntry version_entry,
ScopedTempWebBundleFile bundle) { … }
void IsolatedWebAppUpdateDiscoveryTask::OnWebBundleDownloaded(
const base::Version& expected_version,
int32_t net_error) { … }
void IsolatedWebAppUpdateDiscoveryTask::OnUpdateDryRunDone(
IsolatedWebAppUpdatePrepareAndStoreCommandResult result) { … }
void IsolatedWebAppUpdateDiscoveryTask::SucceedWith(Success success) { … }
void IsolatedWebAppUpdateDiscoveryTask::FailWith(Error error) { … }
base::Value IsolatedWebAppUpdateDiscoveryTask::AsDebugValue() const { … }
std::ostream& operator<<(
std::ostream& os,
const IsolatedWebAppUpdateDiscoveryTask::Success& success) { … }
std::ostream& operator<<(
std::ostream& os,
const IsolatedWebAppUpdateDiscoveryTask::Error& error) { … }
}