// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_BASE_SCHEMEFUL_SITE_H_ #define NET_BASE_SCHEMEFUL_SITE_H_ #include <optional> #include <ostream> #include <string> #include "base/gtest_prod_util.h" #include "base/types/pass_key.h" #include "net/base/net_export.h" #include "url/origin.h" class GURL; namespace blink { class BlinkSchemefulSite; class StorageKey; } // namespace blink namespace IPC { template <class P> struct ParamTraits; } // namespace IPC namespace network::mojom { class SchemefulSiteDataView; } // namespace network::mojom namespace mojo { template <typename DataViewType, typename T> struct StructTraits; } // namespace mojo namespace net { class NetworkAnonymizationKey; class SiteForCookies; // Class which represents a scheme and etld+1 for an origin, as specified by // https://html.spec.whatwg.org/multipage/origin.html#obtain-a-site. // // A SchemefulSite is obtained from an input origin by normalizing, such that: // 1. Opaque origins have distinct SchemefulSites. // 2. Origins whose schemes have network hosts have the same SchemefulSite iff // they share a scheme, and share a hostname or registrable domain. Origins // whose schemes have network hosts include http, https, ws, wss, file, etc. // 3. Origins whose schemes do not have a network host have the same // SchemefulSite iff they share a scheme and host. // 4. Origins which differ only by port have the same SchemefulSite. // 5. Websocket origins cannot have a SchemefulSite (they trigger a DCHECK). // // Note that blink::BlinkSchemefulSite mirrors this class and needs to be kept // in sync with any data member changes. class NET_EXPORT SchemefulSite { … }; // Provided to allow gtest to create more helpful error messages, instead of // printing hex. // // Also used so that SchemefulSites can be the arguments of DCHECK_EQ. NET_EXPORT std::ostream& operator<<(std::ostream& os, const SchemefulSite& ss); } // namespace net #endif // NET_BASE_SCHEMEFUL_SITE_H_