#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_response_reader.h"
#include <memory>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_trust_checker.h"
#include "chrome/browser/web_applications/isolated_web_apps/signed_web_bundle_reader.h"
#include "components/web_package/mojom/web_bundle_parser.mojom-forward.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_id.h"
#include "services/network/public/cpp/resource_request.h"
#include "url/gurl.h"
namespace web_app {
namespace {
network::ResourceRequest RemoveQuery(
network::ResourceRequest resource_request) { … }
}
IsolatedWebAppResponseReaderImpl::IsolatedWebAppResponseReaderImpl(
std::unique_ptr<SignedWebBundleReader> reader,
TrustChecker trust_checker)
: … { … }
IsolatedWebAppResponseReaderImpl::~IsolatedWebAppResponseReaderImpl() = default;
web_package::SignedWebBundleIntegrityBlock
IsolatedWebAppResponseReaderImpl::GetIntegrityBlock() { … }
void IsolatedWebAppResponseReaderImpl::ReadResponse(
const network::ResourceRequest& resource_request,
ReadResponseCallback callback) { … }
void IsolatedWebAppResponseReaderImpl::OnResponseRead(
ReadResponseCallback callback,
base::expected<web_package::mojom::BundleResponsePtr,
SignedWebBundleReader::ReadResponseError> response_head) { … }
void IsolatedWebAppResponseReaderImpl::Close(base::OnceClosure callback) { … }
void IsolatedWebAppResponseReaderImpl::OnClosed(base::OnceClosure callback) { … }
IsolatedWebAppResponseReader::Response::Response(
web_package::mojom::BundleResponsePtr head,
base::WeakPtr<SignedWebBundleReader> reader)
: … { … }
IsolatedWebAppResponseReader::Response::Response(Response&&) = default;
IsolatedWebAppResponseReader::Response&
IsolatedWebAppResponseReader::Response::operator=(Response&&) = default;
IsolatedWebAppResponseReader::Response::~Response() = default;
void IsolatedWebAppResponseReader::Response::ReadBody(
mojo::ScopedDataPipeProducerHandle producer_handle,
base::OnceCallback<void(net::Error net_error)> callback) { … }
IsolatedWebAppResponseReader::Error
IsolatedWebAppResponseReader::Error::FromSignedWebBundleReaderError(
const SignedWebBundleReader::ReadResponseError& error) { … }
base::expected<void, IsolatedWebAppResponseReader::Error>
IsolatedWebAppResponseReader::Error::FromTrustCheckerResult(
const IsolatedWebAppTrustChecker::Result& result) { … }
}