#include "services/network/shared_dictionary/shared_dictionary_storage.h"
#include <algorithm>
#include <optional>
#include <string_view>
#include <vector>
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/strings/pattern.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "net/base/io_buffer.h"
#include "net/http/http_response_headers.h"
#include "net/http/structured_headers.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/request_destination.h"
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "services/network/public/mojom/shared_dictionary_error.mojom.h"
#include "services/network/shared_dictionary/shared_dictionary_constants.h"
#include "services/network/shared_dictionary/shared_dictionary_writer.h"
#include "services/network/shared_dictionary/simple_url_pattern_matcher.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
namespace network {
namespace {
constexpr std::string_view kDefaultTypeRaw = …;
class DictionaryHeaderInfo { … };
base::TimeDelta CalculateExpiration(const net::HttpResponseHeaders& headers,
const base::Time request_time,
const base::Time response_time) { … }
base::expected<DictionaryHeaderInfo, mojom::SharedDictionaryError>
ParseDictionaryHeaderInfo(const std::string& use_as_dictionary_header) { … }
}
SharedDictionaryStorage::SharedDictionaryStorage() = default;
SharedDictionaryStorage::~SharedDictionaryStorage() = default;
base::expected<scoped_refptr<SharedDictionaryWriter>,
mojom::SharedDictionaryError>
SharedDictionaryStorage::MaybeCreateWriter(
const std::string& use_as_dictionary_header,
bool shared_dictionary_writer_enabled,
SharedDictionaryStorage* storage,
mojom::RequestMode request_mode,
mojom::FetchResponseType response_tainting,
const GURL& url,
const base::Time request_time,
const base::Time response_time,
const net::HttpResponseHeaders& headers,
bool was_fetched_via_cache,
base::OnceCallback<bool()> access_allowed_check_callback) { … }
}