// Copyright 2024 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_FINGERPRINTING_PROTECTION_FILTER_BROWSER_THROTTLE_MANAGER_H_ #define COMPONENTS_FINGERPRINTING_PROTECTION_FILTER_BROWSER_THROTTLE_MANAGER_H_ #include <map> #include <memory> #include <optional> #include <vector> #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "base/memory/raw_ref.h" #include "base/memory/weak_ptr.h" #include "base/supports_user_data.h" #include "components/subresource_filter/content/shared/browser/page_load_statistics.h" #include "components/subresource_filter/core/browser/verified_ruleset_dealer.h" #include "components/subresource_filter/core/common/activation_decision.h" #include "components/subresource_filter/core/mojom/subresource_filter.mojom.h" #include "content/public/browser/document_user_data.h" #include "content/public/browser/navigation_handle_user_data.h" class GURL; namespace content { class NavigationHandle; class NavigationThrottle; class Page; class RenderFrameHost; } // namespace content namespace subresource_filter { class AsyncDocumentSubresourceFilter; class ActivationStateComputingNavigationThrottle; } // namespace subresource_filter namespace fingerprinting_protection_filter { class FingerprintingProtectionWebContentsHelper; // The `ThrottleManager` manages throttles that calculate frame activation // states and child frame navigation filtering, within a given Page. // // This class is created for each `Page` that is a "root". Most `Pages` are // roots so that each of (e.g. primary page, prerender, BFCache'd page, etc.) // uses its own separate and independent `DocumentSubresourceFilter` (e.g. each // computes main frame activation separately). Fenced frames are an exception. A // fenced frame does create a separate `Page` but is considered a "child" of its // embedder; behaviorally, we treat it like a regular iframe. See // `IsInSubresourceFilterRoot` in subresource_filter_utils.cc. The term "main // frame" is avoided in this code to avoid ambiguity; instead, the main frame of // a page that is a root is called a "root frame" while other frames are called // "child frames". // // Since this class is associated with a `Page`, cross-document navigation to a // new `Page` will create a new instance of this class. // // Instances of this class are created by the // `FingerprintingProtectionWebContentsHelper` class, of which there is 1 per // `WebContents`, on navigation starts that will create a new eligible `Page`. // This class is initially owned by the `NavigationHandle` that creates it. If // the navigation commits, this class will be transferred to be owned by the\ // `Page` it is associated with. Otherwise it will be destroyed with the // `NavigationHandle`. class ThrottleManager : public base::SupportsUserData::Data { … }; } // namespace fingerprinting_protection_filter #endif // COMPONENTS_FINGERPRINTING_PROTECTION_FILTER_BROWSER_THROTTLE_MANAGER_H_