#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_response_reader_factory.h"
#include <memory>
#include <optional>
#include <string>
#include "base/functional/bind.h"
#include "base/functional/overloaded.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "chrome/browser/web_applications/isolated_web_apps/error/uma_logging.h"
#include "chrome/browser/web_applications/isolated_web_apps/error/unusable_swbn_file_error.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_trust_checker.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_validator.h"
#include "chrome/browser/web_applications/isolated_web_apps/signed_web_bundle_reader.h"
#include "chrome/common/url_constants.h"
#include "components/web_package/mojom/web_bundle_parser.mojom.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_id.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_integrity_block.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_signature_verifier.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace web_app {
IsolatedWebAppResponseReaderFactory::IsolatedWebAppResponseReaderFactory(
Profile& profile,
std::unique_ptr<IsolatedWebAppValidator> validator,
base::RepeatingCallback<
std::unique_ptr<web_package::SignedWebBundleSignatureVerifier>()>
signature_verifier_factory)
: … { … }
IsolatedWebAppResponseReaderFactory::~IsolatedWebAppResponseReaderFactory() { … }
void IsolatedWebAppResponseReaderFactory::CreateResponseReader(
const base::FilePath& web_bundle_path,
const web_package::SignedWebBundleId& web_bundle_id,
Flags flags,
Callback callback) { … }
std::string IsolatedWebAppResponseReaderFactory::ErrorToString(
const UnusableSwbnFileError& error) { … }
void IsolatedWebAppResponseReaderFactory::OnIntegrityBlockRead(
std::unique_ptr<SignedWebBundleReader> reader,
const base::FilePath& web_bundle_path,
const web_package::SignedWebBundleId& web_bundle_id,
Flags flags,
Callback callback,
base::expected<web_package::SignedWebBundleIntegrityBlock,
UnusableSwbnFileError> result) { … }
void IsolatedWebAppResponseReaderFactory::OnIntegrityBlockAndMetadataRead(
std::unique_ptr<SignedWebBundleReader> reader,
const base::FilePath& web_bundle_path,
const web_package::SignedWebBundleId& web_bundle_id,
Flags flags,
Callback callback,
base::expected<void, UnusableSwbnFileError> status) { … }
}