#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
#include "url/url_canon.h"
using enum safe_browsing::ExtendedReportingLevel;
namespace {
void RecordExtendedReportingPrefChanged(
const PrefService& prefs,
safe_browsing::ExtendedReportingOptInLocation location) { … }
GURL GetSimplifiedURL(const GURL& url) { … }
}
namespace safe_browsing {
SafeBrowsingState GetSafeBrowsingState(const PrefService& prefs) { … }
void SetSafeBrowsingState(PrefService* prefs,
SafeBrowsingState state,
bool is_esb_enabled_in_sync) { … }
bool IsSafeBrowsingEnabled(const PrefService& prefs) { … }
bool IsEnhancedProtectionEnabled(const PrefService& prefs) { … }
ExtendedReportingLevel GetExtendedReportingLevel(const PrefService& prefs) { … }
bool IsExtendedReportingOptInAllowed(const PrefService& prefs) { … }
bool IsExtendedReportingEnabled(const PrefService& prefs) { … }
bool IsExtendedReportingEnabledBypassDeprecationFlag(const PrefService& prefs) { … }
bool IsExtendedReportingPolicyManaged(const PrefService& prefs) { … }
bool IsSafeBrowsingPolicyManaged(const PrefService& prefs) { … }
bool IsSafeBrowsingExtensionControlled(const PrefService& prefs) { … }
bool AreHashPrefixRealTimeLookupsAllowedByPolicy(const PrefService& prefs) { … }
bool AreDeepScansAllowedByPolicy(const PrefService& prefs) { … }
bool IsSafeBrowsingSurveysEnabled(const PrefService& prefs) { … }
bool IsSafeBrowsingProceedAnywayDisabled(const PrefService& prefs) { … }
void RecordExtendedReportingMetrics(const PrefService& prefs) { … }
void RegisterProfilePrefs(PrefRegistrySimple* registry) { … }
const base::Value::Dict& GetExtensionTelemetryConfig(const PrefService& prefs) { … }
const base::Value::Dict& GetExtensionTelemetryFileData(
const PrefService& prefs) { … }
void SetExtensionTelemetryConfig(PrefService& prefs,
const base::Value::Dict& config) { … }
base::Time GetLastUploadTimeForExtensionTelemetry(PrefService& prefs) { … }
void SetLastUploadTimeForExtensionTelemetry(PrefService& prefs,
const base::Time& time) { … }
void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { … }
void SetExtendedReportingPrefAndMetric(
PrefService* prefs,
bool value,
ExtendedReportingOptInLocation location) { … }
void SetExtendedReportingPrefForTests(PrefService* prefs, bool value) { … }
void SetEnhancedProtectionPrefForTests(PrefService* prefs, bool value) { … }
void SetEnhancedProtectionPref(PrefService* prefs, bool value) { … }
void SetStandardProtectionPref(PrefService* prefs, bool value) { … }
void UpdatePrefsBeforeSecurityInterstitial(PrefService* prefs) { … }
base::Value::List GetSafeBrowsingPreferencesList(PrefService* prefs) { … }
base::Value::List GetSafeBrowsingPoliciesList(PrefService* prefs) { … }
void GetSafeBrowsingAllowlistDomainsPref(
const PrefService& prefs,
std::vector<std::string>* out_canonicalized_domain_list) { … }
void CanonicalizeDomainList(
const base::Value::List& raw_domain_list,
std::vector<std::string>* out_canonicalized_domain_list) { … }
bool IsURLAllowlistedByPolicy(const GURL& url, const PrefService& pref) { … }
std::vector<std::string> GetURLAllowlistByPolicy(PrefService* pref_service) { … }
bool MatchesEnterpriseAllowlist(const PrefService& pref,
const std::vector<GURL>& url_chain) { … }
void GetPasswordProtectionLoginURLsPref(const PrefService& prefs,
std::vector<GURL>* out_login_url_list) { … }
bool MatchesPasswordProtectionLoginURL(const GURL& url,
const PrefService& prefs) { … }
bool MatchesURLList(const GURL& target_url, const std::vector<GURL> url_list) { … }
GURL GetPasswordProtectionChangePasswordURLPref(const PrefService& prefs) { … }
bool MatchesPasswordProtectionChangePasswordURL(const GURL& url,
const PrefService& prefs) { … }
}