chromium/third_party/blink/renderer/platform/exported/web_url_response.cc

/*
 * Copyright (C) 2009 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "third_party/blink/public/platform/web_url_response.h"

#include <memory>
#include <utility>
#include <vector>

#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/ranges/algorithm.h"
#include "net/ssl/ssl_info.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "services/network/public/mojom/cors.mojom-shared.h"
#include "services/network/public/mojom/ip_address_space.mojom-shared.h"
#include "services/network/public/mojom/load_timing_info.mojom.h"
#include "services/network/public/mojom/service_worker_router_info.mojom-blink.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/platform/web_http_header_visitor.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_load_timing.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
#include "third_party/blink/renderer/platform/loader/fetch/service_worker_router_info.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"

namespace blink {

namespace {

// Converts timing data from |load_timing| to the mojo type.
// TODO:(https://crbug.com/1379780): Consider removing unnecessary type
// conversions.
network::mojom::LoadTimingInfo ToMojoLoadTiming(
    const net::LoadTimingInfo& load_timing) {}

// TODO(https://crbug.com/862940): Use KURL here.
void SetSecurityStyleAndDetails(const GURL& url,
                                const network::mojom::URLResponseHead& head,
                                WebURLResponse* response,
                                bool report_security_info) {}

}  // namespace

// static
WebURLResponse WebURLResponse::Create(
    const WebURL& url,
    const network::mojom::URLResponseHead& head,
    bool report_security_info,
    int request_id) {}

WebURLResponse::~WebURLResponse() = default;

WebURLResponse::WebURLResponse()
    :{}

WebURLResponse::WebURLResponse(const WebURLResponse& r)
    :{}

WebURLResponse::WebURLResponse(const WebURL& current_request_url)
    :{}

WebURLResponse& WebURLResponse::operator=(const WebURLResponse& r) {}

bool WebURLResponse::IsNull() const {}

WebURL WebURLResponse::CurrentRequestUrl() const {}

void WebURLResponse::SetCurrentRequestUrl(const WebURL& url) {}

WebURL WebURLResponse::ResponseUrl() const {}

void WebURLResponse::SetConnectionID(unsigned connection_id) {}

void WebURLResponse::SetConnectionReused(bool connection_reused) {}

void WebURLResponse::SetLoadTiming(
    const network::mojom::LoadTimingInfo& mojo_timing) {}

base::Time WebURLResponse::ResponseTime() const {}

void WebURLResponse::SetResponseTime(base::Time response_time) {}

WebString WebURLResponse::MimeType() const {}

void WebURLResponse::SetMimeType(const WebString& mime_type) {}

int64_t WebURLResponse::ExpectedContentLength() const {}

void WebURLResponse::SetExpectedContentLength(int64_t expected_content_length) {}

void WebURLResponse::SetTextEncodingName(const WebString& text_encoding_name) {}

WebURLResponse::HTTPVersion WebURLResponse::HttpVersion() const {}

void WebURLResponse::SetHttpVersion(HTTPVersion version) {}

int WebURLResponse::RequestId() const {}

void WebURLResponse::SetRequestId(int request_id) {}

int WebURLResponse::HttpStatusCode() const {}

void WebURLResponse::SetHttpStatusCode(int http_status_code) {}

WebString WebURLResponse::HttpStatusText() const {}

void WebURLResponse::SetHttpStatusText(const WebString& http_status_text) {}

void WebURLResponse::SetEmittedExtraInfo(bool emitted_extra_info) {}

WebString WebURLResponse::HttpHeaderField(const WebString& name) const {}

void WebURLResponse::SetHttpHeaderField(const WebString& name,
                                        const WebString& value) {}

void WebURLResponse::AddHttpHeaderField(const WebString& name,
                                        const WebString& value) {}

void WebURLResponse::ClearHttpHeaderField(const WebString& name) {}

void WebURLResponse::VisitHttpHeaderFields(
    WebHTTPHeaderVisitor* visitor) const {}

void WebURLResponse::SetHasMajorCertificateErrors(bool value) {}

void WebURLResponse::SetHasRangeRequested(bool value) {}

bool WebURLResponse::TimingAllowPassed() const {}

void WebURLResponse::SetTimingAllowPassed(bool value) {}

void WebURLResponse::SetSecurityStyle(SecurityStyle security_style) {}

void WebURLResponse::SetSSLInfo(const net::SSLInfo& ssl_info) {}

const ResourceResponse& WebURLResponse::ToResourceResponse() const {}

void WebURLResponse::SetWasCached(bool value) {}

bool WebURLResponse::WasFetchedViaSPDY() const {}

void WebURLResponse::SetWasFetchedViaSPDY(bool value) {}

bool WebURLResponse::WasFetchedViaServiceWorker() const {}

void WebURLResponse::SetWasFetchedViaServiceWorker(bool value) {}

network::mojom::FetchResponseSource
WebURLResponse::GetServiceWorkerResponseSource() const {}

void WebURLResponse::SetServiceWorkerRouterInfo(
    const network::mojom::ServiceWorkerRouterInfo& value) {}

void WebURLResponse::SetServiceWorkerResponseSource(
    network::mojom::FetchResponseSource value) {}

void WebURLResponse::SetDidUseSharedDictionary(bool did_use_shared_dictionary) {}

void WebURLResponse::SetType(network::mojom::FetchResponseType value) {}

network::mojom::FetchResponseType WebURLResponse::GetType() const {}

void WebURLResponse::SetPadding(int64_t padding) {}

int64_t WebURLResponse::GetPadding() const {}

void WebURLResponse::SetUrlListViaServiceWorker(
    const WebVector<WebURL>& url_list_via_service_worker) {}

bool WebURLResponse::HasUrlListViaServiceWorker() const {}

WebString WebURLResponse::CacheStorageCacheName() const {}

void WebURLResponse::SetCacheStorageCacheName(
    const WebString& cache_storage_cache_name) {}

WebVector<WebString> WebURLResponse::CorsExposedHeaderNames() const {}

void WebURLResponse::SetCorsExposedHeaderNames(
    const WebVector<WebString>& header_names) {}

void WebURLResponse::SetDidServiceWorkerNavigationPreload(bool value) {}

net::IPEndPoint WebURLResponse::RemoteIPEndpoint() const {}

void WebURLResponse::SetRemoteIPEndpoint(
    const net::IPEndPoint& remote_ip_endpoint) {}

network::mojom::IPAddressSpace WebURLResponse::AddressSpace() const {}

void WebURLResponse::SetAddressSpace(
    network::mojom::IPAddressSpace remote_ip_address_space) {}

network::mojom::IPAddressSpace WebURLResponse::ClientAddressSpace() const {}

void WebURLResponse::SetClientAddressSpace(
    network::mojom::IPAddressSpace client_address_space) {}

network::mojom::PrivateNetworkAccessPreflightResult
WebURLResponse::PrivateNetworkAccessPreflightResult() const {}

void WebURLResponse::SetPrivateNetworkAccessPreflightResult(
    network::mojom::PrivateNetworkAccessPreflightResult result) {}

void WebURLResponse::SetIsValidated(bool is_validated) {}

void WebURLResponse::SetEncodedDataLength(int64_t length) {}

int64_t WebURLResponse::EncodedBodyLength() const {}

void WebURLResponse::SetEncodedBodyLength(uint64_t length) {}

void WebURLResponse::SetIsSignedExchangeInnerResponse(
    bool is_signed_exchange_inner_response) {}

void WebURLResponse::SetIsWebBundleInnerResponse(
    bool is_web_bundle_inner_response) {}

void WebURLResponse::SetWasInPrefetchCache(bool was_in_prefetch_cache) {}

void WebURLResponse::SetWasCookieInRequest(bool was_cookie_in_request) {}

void WebURLResponse::SetRecursivePrefetchToken(
    const std::optional<base::UnguessableToken>& token) {}

bool WebURLResponse::WasAlpnNegotiated() const {}

void WebURLResponse::SetWasAlpnNegotiated(bool was_alpn_negotiated) {}

WebString WebURLResponse::AlpnNegotiatedProtocol() const {}

void WebURLResponse::SetAlpnNegotiatedProtocol(
    const WebString& alpn_negotiated_protocol) {}

void WebURLResponse::SetAlternateProtocolUsage(
    const net::AlternateProtocolUsage alternate_protocol_usage) {}

bool WebURLResponse::HasAuthorizationCoveredByWildcardOnPreflight() const {}

void WebURLResponse::SetHasAuthorizationCoveredByWildcardOnPreflight(bool b) {}

bool WebURLResponse::WasAlternateProtocolAvailable() const {}

void WebURLResponse::SetWasAlternateProtocolAvailable(
    bool was_alternate_protocol_available) {}

net::HttpConnectionInfo WebURLResponse::ConnectionInfo() const {}

void WebURLResponse::SetConnectionInfo(
    net::HttpConnectionInfo connection_info) {}

void WebURLResponse::SetAsyncRevalidationRequested(bool requested) {}

void WebURLResponse::SetNetworkAccessed(bool network_accessed) {}

bool WebURLResponse::FromArchive() const {}

void WebURLResponse::SetDnsAliases(const WebVector<WebString>& aliases) {}

void WebURLResponse::SetAuthChallengeInfo(
    const std::optional<net::AuthChallengeInfo>& auth_challenge_info) {}

const std::optional<net::AuthChallengeInfo>& WebURLResponse::AuthChallengeInfo()
    const {}

void WebURLResponse::SetRequestIncludeCredentials(
    bool request_include_credentials) {}

bool WebURLResponse::RequestIncludeCredentials() const {}

void WebURLResponse::SetShouldUseSourceHashForJSCodeCache(
    bool should_use_source_hash_for_js_code_cache) {}

bool WebURLResponse::ShouldUseSourceHashForJSCodeCache() const {}

WebURLResponse::WebURLResponse(ResourceResponse& r) :{}

}  // namespace blink