55 lines
1.8 KiB
C++
55 lines
1.8 KiB
C++
|
|
// Copyright 2021 The Chromium Authors
|
||
|
|
// Use of this source code is governed by a BSD-style license that can be
|
||
|
|
// found in the LICENSE file.
|
||
|
|
|
||
|
|
#include "net/cookies/cookie_partition_key_collection.h"
|
||
|
|
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
#include "base/containers/contains.h"
|
||
|
|
#include "base/containers/flat_map.h"
|
||
|
|
#include "base/containers/flat_set.h"
|
||
|
|
#include "base/functional/bind.h"
|
||
|
|
#include "base/functional/callback.h"
|
||
|
|
#include "net/base/schemeful_site.h"
|
||
|
|
#include "net/cookies/cookie_access_delegate.h"
|
||
|
|
#include "net/cookies/cookie_partition_key.h"
|
||
|
|
#include "net/first_party_sets/first_party_set_entry.h"
|
||
|
|
|
||
|
|
namespace net {
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection::CookiePartitionKeyCollection() = default;
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection::CookiePartitionKeyCollection(
|
||
|
|
const CookiePartitionKeyCollection& other) = default;
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection::CookiePartitionKeyCollection(
|
||
|
|
CookiePartitionKeyCollection&& other) = default;
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection::CookiePartitionKeyCollection(
|
||
|
|
const CookiePartitionKey& key)
|
||
|
|
: CookiePartitionKeyCollection(base::flat_set<CookiePartitionKey>({key})) {}
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection::CookiePartitionKeyCollection(
|
||
|
|
base::flat_set<CookiePartitionKey> keys)
|
||
|
|
: keys_(std::move(keys)) {}
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection::CookiePartitionKeyCollection(
|
||
|
|
bool contains_all_keys)
|
||
|
|
: contains_all_keys_(contains_all_keys) {}
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection& CookiePartitionKeyCollection::operator=(
|
||
|
|
const CookiePartitionKeyCollection& other) = default;
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection& CookiePartitionKeyCollection::operator=(
|
||
|
|
CookiePartitionKeyCollection&& other) = default;
|
||
|
|
|
||
|
|
CookiePartitionKeyCollection::~CookiePartitionKeyCollection() = default;
|
||
|
|
|
||
|
|
bool CookiePartitionKeyCollection::Contains(
|
||
|
|
const CookiePartitionKey& key) const {
|
||
|
|
return contains_all_keys_ || base::Contains(keys_, key);
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace net
|