chromium/third_party/blink/renderer/platform/weborigin/security_origin.cc

/*
 * Copyright (C) 2007 Apple 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:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  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.
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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/renderer/platform/weborigin/security_origin.h"

#include <stdint.h>

#include <memory>
#include <string>
#include <utility>

#include "base/containers/contains.h"
#include "net/base/url_util.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/platform/blob/blob_url.h"
#include "third_party/blink/renderer/platform/blob/blob_url_null_origin_map.h"
#include "third_party/blink/renderer/platform/weborigin/known_ports.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/origin_access_entry.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "third_party/blink/renderer/platform/weborigin/security_policy.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/wtf.h"
#include "url/scheme_host_port.h"
#include "url/url_canon.h"
#include "url/url_canon_ip.h"
#include "url/url_util.h"

namespace blink {

namespace {

const String& EnsureNonNull(const String& string) {}

}  // namespace

bool SecurityOrigin::ShouldUseInnerURL(const KURL& url) {}

// In general, extracting the inner URL varies by scheme. It just so happens
// that all the URL schemes we currently support that use inner URLs for their
// security origin can be parsed using this algorithm.
KURL SecurityOrigin::ExtractInnerURL(const KURL& url) {}

// Note: When changing ShouldTreatAsOpaqueOrigin, consider also updating
// IsValidInput in //url/scheme_host_port.cc (there might be existing
// differences in behavior between these 2 layers, but we should avoid
// introducing new differences).
static bool ShouldTreatAsOpaqueOrigin(const KURL& url) {}

scoped_refptr<SecurityOrigin> SecurityOrigin::CreateInternal(const KURL& url) {}

SecurityOrigin::SecurityOrigin(const String& protocol,
                               const String& host,
                               uint16_t port)
    :{}

SecurityOrigin::SecurityOrigin(const url::Origin::Nonce& nonce,
                               const SecurityOrigin* precursor)
    :{}

SecurityOrigin::SecurityOrigin(NewUniqueOpaque, const SecurityOrigin* precursor)
    :{}

SecurityOrigin::SecurityOrigin(const SecurityOrigin* other,
                               ConstructIsolatedCopy)
    :{}

SecurityOrigin::SecurityOrigin(const SecurityOrigin* other,
                               ConstructSameThreadCopy)
    :{}

scoped_refptr<SecurityOrigin> SecurityOrigin::CreateWithReferenceOrigin(
    const KURL& url,
    const SecurityOrigin* reference_origin) {}

scoped_refptr<SecurityOrigin> SecurityOrigin::Create(const KURL& url) {}

scoped_refptr<SecurityOrigin> SecurityOrigin::CreateUniqueOpaque() {}

scoped_refptr<SecurityOrigin> SecurityOrigin::CreateOpaque(
    const url::Origin::Nonce& nonce,
    const SecurityOrigin* precursor) {}

scoped_refptr<SecurityOrigin> SecurityOrigin::CreateFromUrlOrigin(
    const url::Origin& origin) {}

url::Origin SecurityOrigin::ToUrlOrigin() const {}

scoped_refptr<SecurityOrigin> SecurityOrigin::IsolatedCopy() const {}

void SecurityOrigin::SetDomainFromDOM(const String& new_domain) {}

String SecurityOrigin::RegistrableDomain() const {}

const base::UnguessableToken* SecurityOrigin::GetNonceForSerialization() const {}

bool SecurityOrigin::CanAccess(const SecurityOrigin* other,
                               AccessResultDomainDetail& detail) const {}

bool SecurityOrigin::PassesFileCheck(const SecurityOrigin* other) const {}

bool SecurityOrigin::CanRequest(const KURL& url) const {}

bool SecurityOrigin::CanReadContent(const KURL& url) const {}

bool SecurityOrigin::CanDisplay(const KURL& url) const {}

bool SecurityOrigin::IsPotentiallyTrustworthy() const {}

// static
String SecurityOrigin::IsPotentiallyTrustworthyErrorMessage() {}

void SecurityOrigin::GrantLoadLocalResources() {}

void SecurityOrigin::GrantUniversalAccess() {}

void SecurityOrigin::GrantCrossAgentClusterAccess() {}

void SecurityOrigin::BlockLocalAccessFromLocalOrigin() {}

bool SecurityOrigin::IsLocal() const {}

bool SecurityOrigin::IsLocalhost() const {}

String SecurityOrigin::ToString() const {}

AtomicString SecurityOrigin::ToAtomicString() const {}

String SecurityOrigin::ToRawString() const {}

void SecurityOrigin::BuildRawString(StringBuilder& builder) const {}

String SecurityOrigin::ToTokenForFastCheck() const {}

scoped_refptr<SecurityOrigin> SecurityOrigin::CreateFromString(
    const String& origin_string) {}

scoped_refptr<SecurityOrigin> SecurityOrigin::CreateFromValidTuple(
    const String& protocol,
    const String& host,
    uint16_t port) {}

bool SecurityOrigin::IsSameOriginWith(const SecurityOrigin* other) const {}

bool SecurityOrigin::AreSameOrigin(const KURL& a, const KURL& b) {}

bool SecurityOrigin::IsSameOriginDomainWith(
    const SecurityOrigin* other,
    AccessResultDomainDetail& detail) const {}

bool SecurityOrigin::IsSameSiteWith(const SecurityOrigin* other) const {}

const KURL& SecurityOrigin::UrlWithUniqueOpaqueOrigin() {}

std::unique_ptr<SecurityOrigin::PrivilegeData>
SecurityOrigin::CreatePrivilegeData() const {}

void SecurityOrigin::TransferPrivilegesFrom(
    std::unique_ptr<PrivilegeData> privilege_data) {}

void SecurityOrigin::SetOpaqueOriginIsPotentiallyTrustworthy(
    bool is_opaque_origin_potentially_trustworthy) {}

scoped_refptr<SecurityOrigin> SecurityOrigin::DeriveNewOpaqueOrigin() const {}

const SecurityOrigin* SecurityOrigin::GetOriginOrPrecursorOriginIfOpaque()
    const {}

String SecurityOrigin::CanonicalizeHost(const String& host, bool* success) {}

scoped_refptr<SecurityOrigin> SecurityOrigin::GetOriginForAgentCluster(
    const base::UnguessableToken& agent_cluster_id) {}

bool SecurityOrigin::SerializesAsNull() const {}

}  // namespace blink