chromium/services/network/public/cpp/cross_origin_opener_policy_parser.cc

// Copyright 2019 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/cross_origin_opener_policy_parser.h"

#include <string_view>

#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "net/http/http_response_headers.h"
#include "net/http/structured_headers.h"
#include "services/network/public/cpp/cross_origin_opener_policy.h"
#include "services/network/public/cpp/features.h"

namespace network {

namespace {

// Const definition of the strings involved in the header parsing.
constexpr char kCrossOriginOpenerPolicyHeader[] =;
constexpr char kCrossOriginOpenerPolicyHeaderReportOnly[] =;
constexpr char kSameOrigin[] =;
constexpr char kSameOriginAllowPopups[] =;
constexpr char kRestrictProperties[] =;
constexpr char kUnsafeNone[] =;
constexpr char kReportTo[] =;
constexpr char kNoopenerAllowPopups[] =;

// Fills |value|, |endpoint| and an optional |soap_by_default_value| with
// parsed values from |header|.
// Note: if |header| is invalid, |value|, |soap_by_default_value| and
// |endpoint| will not be modified.
void ParseHeader(std::string_view header_value,
                 mojom::CrossOriginOpenerPolicyValue* value,
                 mojom::CrossOriginOpenerPolicyValue* soap_by_default_value,
                 std::optional<std::string>* endpoint) {}

}  // namespace

CrossOriginOpenerPolicy ParseCrossOriginOpenerPolicy(
    const net::HttpResponseHeaders& headers) {}

}  // namespace network