#include "third_party/blink/public/common/shared_storage/module_script_downloader.h"
#include <string_view>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/common/mime_util/mime_util.h"
#include "url/gurl.h"
namespace blink {
namespace {
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
bool IsAllowedCharset(std::string_view charset, const std::string& body) { … }
}
ModuleScriptDownloader::ModuleScriptDownloader(
network::mojom::URLLoaderFactory* url_loader_factory,
const GURL& source_url,
ModuleScriptDownloaderCallback module_script_downloader_callback)
: … { … }
ModuleScriptDownloader::~ModuleScriptDownloader() = default;
void ModuleScriptDownloader::OnBodyReceived(std::unique_ptr<std::string> body) { … }
void ModuleScriptDownloader::OnRedirect(
const GURL& url_before_redirect,
const net::RedirectInfo& redirect_info,
const network::mojom::URLResponseHead& response_head,
std::vector<std::string>* removed_headers) { … }
}