// 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_SSL_HTTPS_FIRST_MODE_SETTINGS_TRACKER_H_ #define CHROME_BROWSER_SSL_HTTPS_FIRST_MODE_SETTINGS_TRACKER_H_ #include <vector> #include "base/memory/raw_ptr.h" #include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" #include "base/task/task_traits.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" #include "chrome/browser/safe_browsing/advanced_protection_status_manager.h" #include "chrome/browser/ssl/daily_navigation_counter.h" #include "components/keyed_service/core/keyed_service.h" #include "components/prefs/pref_change_registrar.h" #include "components/site_engagement/content/site_engagement_score.h" #include "content/public/browser/browser_thread.h" class Profile; namespace base { class Clock; } namespace site_engagement { class SiteEngagementService; } class StatefulSSLHostStateDelegate; // The set of valid states of the user-controllable HTTPS-First Mode setting. // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. // Must be kept in sync with the HttpsFirstModeSetting enums located in // chrome/browser/resources/settings/privacy_page/security_page.ts and enums.xml // LINT.IfChange enum class HttpsFirstModeSetting { … }; // LINT.ThenChange(/tools/metrics/histograms/metadata/security/enums.xml) // A `KeyedService` that tracks changes to the HTTPS-First Mode pref for each // profile. This is currently used for: // - Recording pref state in metrics and registering the client for a synthetic // field trial based on that state. // - Changing the pref based on user's Advanced Protection status. // - Checking the Site Engagement scores of a site and enable/disable HFM based // on that. class HttpsFirstModeService : public KeyedService, public safe_browsing::AdvancedProtectionStatusManager:: StatusChangedObserver { … }; // Factory boilerplate for creating the `HttpsFirstModeService` for each browser // context (profile). class HttpsFirstModeServiceFactory : public ProfileKeyedServiceFactory { … }; #endif // CHROME_BROWSER_SSL_HTTPS_FIRST_MODE_SETTINGS_TRACKER_H_