chromium/content/browser/interest_group/interest_group_permissions_checker.h

// 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.

#ifndef CONTENT_BROWSER_INTEREST_GROUP_INTEREST_GROUP_PERMISSIONS_CHECKER_H_
#define CONTENT_BROWSER_INTEREST_GROUP_INTEREST_GROUP_PERMISSIONS_CHECKER_H_

#include "content/common/content_export.h"

#include <list>
#include <map>
#include <memory>
#include <tuple>

#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "content/browser/interest_group/interest_group_permissions_cache.h"
#include "net/base/network_isolation_key.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "url/origin.h"

namespace network {
class SimpleURLLoader;
}

namespace content {

// Responsible for checking whether a frame can join or leave an interest group.
// Performs .well-known fetches if necessary.
//
// Groups permissions checks that can be handled by the same .well-known fetch,
// to avoid redundant fetches.
//
// TODO(crbug.com/40221941):
// * Consider adding a per-NIK / per-page / per-frame LRU cache. Roundtrip to
//   the HTTP cache are slow, and we'll likely want to limit the number of
//   pending operations the renderer sends to the browser process at a time.
// * Add detailed error information to DevTools or as a Promise failure on
//   rejection.
// * Figure out integration with IsInterestGroupAPIAllowed() - e.g., for
//   cross-origin iframes, there are 3 origins (top-level frame, iframe,
//   interest group frame). Currently we're not considering iframe origin at
//   all. Should we be?
class CONTENT_EXPORT InterestGroupPermissionsChecker {};

}  // namespace content

#endif  // CONTENT_BROWSER_INTEREST_GROUP_INTEREST_GROUP_PERMISSIONS_CHECKER_H_