chromium/content/browser/browsing_topics/browsing_topics_url_loader_interceptor.h

// Copyright 2023 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_BROWSING_TOPICS_BROWSING_TOPICS_URL_LOADER_INTERCEPTOR_H_
#define CONTENT_BROWSER_BROWSING_TOPICS_BROWSING_TOPICS_URL_LOADER_INTERCEPTOR_H_

#include "content/browser/loader/subresource_proxying_url_loader.h"

namespace content {

// A loader interceptor for handling a topics subresource request, including
// fetch(<url>, {browsingTopics: true}).
//
// This loader interceptor works as follows:
//   1. Before making a network request (i.e. WillStartRequest()), if the
//      request is eligible for topics, calculates and adds the topics header.
//   2. For any redirect received (i.e. OnReceiveRedirect()), if the previous
//      request or redirect was eligible for topics, and if the response header
//      indicates an observation should be recorded, stores the observation.
//   3. For any followed redirect (i.e. WillFollowRedirect()),  if the redirect
//      is eligible for topics, calculates and adds/updates the topics header.
//   4. For the last response (i.e. OnReceiveResponse()),  if the previous
//      request or redirect was eligible for topics, and if the response header
//      indicates an observation should be recorded, stores the observation.
class CONTENT_EXPORT BrowsingTopicsURLLoaderInterceptor
    : public SubresourceProxyingURLLoader::Interceptor {};

}  // namespace content

#endif  // CONTENT_BROWSER_BROWSING_TOPICS_BROWSING_TOPICS_URL_LOADER_INTERCEPTOR_H_