// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/dips/cookie_access_filter.h" #include "chrome/browser/dips/dips_utils.h" CookieAccessFilter::CookieAccessFilter() = default; CookieAccessFilter::~CookieAccessFilter() = default; void CookieAccessFilter::AddAccess(const GURL& url, CookieOperation op) { … } // This method attempts to match every entry of this->accesses_ with a member of // `urls`, in order. Other URLs will be treated as kNone. // // Imagine `urls` contains 5 unique URLs [A, B, C, D, E] and this->accesses_ // contains [(B, kRead), (D, kWrite)]; then this will store in `result`: [kNone, // kRead, kNone, kWrite, kNone]. // // It's complicated by the fact that AddAccess() can be called multiple times // redundantly for a single URL visit, so it must coalesce them (see // crbug.com/1335510); yet it's theoretically possible for one URL to be visited // multiple times, even consecutively, in a single redirect chain. // // To handle that corner case (imperfectly), if the same URL appears multiple // times in a row, it will get the same SiteDataAccessType for all of them. bool CookieAccessFilter::Filter(const std::vector<GURL>& urls, std::vector<SiteDataAccessType>* result) const { … }