// Copyright 2017 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_SAFE_BROWSING_CONTENT_BROWSER_TRIGGERS_TRIGGER_MANAGER_H_ #define COMPONENTS_SAFE_BROWSING_CONTENT_BROWSER_TRIGGERS_TRIGGER_MANAGER_H_ #include <unordered_map> #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" #include "components/safe_browsing/content/browser/triggers/trigger_throttler.h" #include "components/safe_browsing/content/browser/web_contents_key.h" #include "components/safe_browsing/core/browser/referrer_chain_provider.h" #include "components/security_interstitials/core/base_safe_browsing_error_ui.h" #include "components/security_interstitials/core/unsafe_resource.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" class PrefService; namespace history { class HistoryService; } namespace network { class SharedURLLoaderFactory; } namespace safe_browsing { class BaseUIManager; class ThreatDetails; // A wrapper around different kinds of data collectors that can be active on a // given browser tab. Any given field can be null or empty if the associated // data is not being collected. struct DataCollectorsContainer { … }; // Stores the data collectors that are active on each WebContents (ie: browser // tab). Keys are derived from WebContents* but should not be dereferenced. DataCollectorsMap; SBErrorOptions; // The reasons that trigger manager fails to create or finish a report. // These values are written to logs. New enum values can be added, but // existing enums must never be renumbered or deleted and reused. enum class TriggerManagerReason { … }; // This class manages SafeBrowsing data-reporting triggers. Triggers are // activated for users opted-in to Extended Reporting and when security-related // data collection is required. // // The TriggerManager has two main responsibilities: 1) ensuring triggers only // run when appropriate, by honouring user opt-ins and incognito state, and 2) // tracking how often triggers fire and throttling them when necessary. class TriggerManager { … }; // A helper class that listens for events happening on a WebContents and can // notify TriggerManager of any that are relevant. class TriggerManagerWebContentsHelper : public content::WebContentsObserver, public content::WebContentsUserData<TriggerManagerWebContentsHelper> { … }; } // namespace safe_browsing #endif // COMPONENTS_SAFE_BROWSING_CONTENT_BROWSER_TRIGGERS_TRIGGER_MANAGER_H_