chromium/services/network/public/cpp/content_security_policy/csp_source.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "services/network/public/cpp/content_security_policy/csp_source.h"

#include <sstream>
#include <string_view>

#include "base/check_op.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "services/network/public/cpp/content_security_policy/content_security_policy.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "url/url_canon.h"
#include "url/url_features.h"
#include "url/url_util.h"

namespace network {

namespace {

bool HasHost(const mojom::CSPSource& source) {}

bool DecodePath(std::string_view path, std::string* output) {}

int DefaultPortForScheme(const std::string& scheme) {}

// NotMatching is the only negative member, the rest are different types of
// matches. NotMatching should always be 0 to let if statements work nicely
enum class PortMatchingResult {};
enum class SchemeMatchingResult {};

SchemeMatchingResult MatchScheme(const std::string& scheme_a,
                                 const std::string& scheme_b) {}

SchemeMatchingResult SourceAllowScheme(const mojom::CSPSource& source,
                                       const GURL& url,
                                       const mojom::CSPSource& self_source) {}

bool SourceAllowHost(const mojom::CSPSource& source, const std::string& host) {}

bool SourceAllowHost(const mojom::CSPSource& source, const GURL& url) {}

PortMatchingResult SourceAllowPort(const mojom::CSPSource& source,
                                   int port,
                                   const std::string& scheme) {}

PortMatchingResult SourceAllowPort(const mojom::CSPSource& source,
                                   const GURL& url) {}

bool SourceAllowPath(const mojom::CSPSource& source, const std::string& path) {}

bool SourceAllowPath(const mojom::CSPSource& source,
                     const GURL& url,
                     bool has_followed_redirect) {}

bool requiresUpgrade(PortMatchingResult result) {}

bool requiresUpgrade(SchemeMatchingResult result) {}

bool canUpgrade(PortMatchingResult result, CSPSourceContext context) {}

bool canUpgrade(SchemeMatchingResult result, CSPSourceContext context) {}

}  // namespace

bool CSPSourceIsSchemeOnly(const mojom::CSPSource& source) {}

bool CheckCSPSource(const mojom::CSPSource& source,
                    const GURL& url,
                    const mojom::CSPSource& self_source,
                    CSPSourceContext context,
                    bool has_followed_redirect,
                    bool is_opaque_fenced_frame) {}

mojom::CSPSourcePtr CSPSourcesIntersect(const mojom::CSPSource& source_a,
                                        const mojom::CSPSource& source_b) {}

// Check whether |source_a| subsumes |source_b|.
bool CSPSourceSubsumes(const mojom::CSPSource& source_a,
                       const mojom::CSPSource& source_b) {}

std::string ToString(const mojom::CSPSource& source) {}

}  // namespace network