// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_SAFE_BROWSING_EXTENSION_TELEMETRY_EXTENSION_TELEMETRY_SERVICE_H_ #define CHROME_BROWSER_SAFE_BROWSING_EXTENSION_TELEMETRY_EXTENSION_TELEMETRY_SERVICE_H_ #include <memory> #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "base/files/file_path.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/threading/sequence_bound.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "base/values.h" #include "components/keyed_service/core/keyed_service.h" #include "components/prefs/pref_change_registrar.h" #include "extensions/common/extension_id.h" #include "extensions/common/extension_set.h" class Profile; class PrefService; namespace extensions { class Extension; class ExtensionPrefs; class ExtensionRegistry; } // namespace extensions namespace network { class SharedURLLoaderFactory; } // namespace network namespace safe_browsing { enum class ExtensionSignalType; class ExtensionSignal; class ExtensionSignalProcessor; class ExtensionTelemetryConfigManager; class ExtensionTelemetryFileProcessor; class ExtensionTelemetryPersister; class ExtensionTelemetryReportRequest; class ExtensionTelemetryReportRequest_ExtensionInfo; class ExtensionTelemetryReportRequest_ExtensionInfo_FileInfo; class ExtensionTelemetryReportResponse; class ExtensionTelemetryUploader; class SafeBrowsingTokenFetcher; // This class processes extension signals and reports telemetry for a given // profile (regular profile only). It is used exclusively on the UI thread. // Lifetime: // The service is instantiated when the associated profile is instantiated. It // is destructed when the corresponding profile is destructed. // Enable/Disable states: // The service is enabled if: // - the user is opted into Enhanced Safe Browsing (ESB) OR // - enterprise telemetry is enabled by a policy // // |esb_enabled_| - Generates telemetry reports for Enhanced Safe Browsing // (ESB) users. When enabled, the service receives/stores signal // information, and collects file data for off-store extensions. // Periodically, the telemetry reports are uploaded to the SB servers. In // the upload response, the CRX telemetry server includes unsafe off-store // extension verdicts that the service can take action on. // |enterprise_enabled_| - Generates enterprise telemetry reports for // managed profiles. When enabled, the service also collects signal // information and file data for off-store extensions. Periodically, the // telemetry reports are sent to the Chrome Enterprise Reporting servers // instead. Unlike the ESB flow, there is no response received when an // enterprise report is sent. // // For both ESB and enterprise: when disabled, any previously stored signal // information is cleared, incoming signals are ignored and no reports are // sent. class ExtensionTelemetryService : public KeyedService { … }; } // namespace safe_browsing #endif // CHROME_BROWSER_SAFE_BROWSING_EXTENSION_TELEMETRY_EXTENSION_TELEMETRY_SERVICE_H_