#include "components/subresource_filter/content/browser/subresource_filter_content_settings_manager.h"
#include <optional>
#include <string>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/json/values_util.h"
#include "base/not_fatal_until.h"
#include "base/time/default_clock.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_constraints.h"
#include "components/content_settings/core/common/content_settings_metadata.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "url/gurl.h"
namespace subresource_filter {
namespace {
const char kInfobarLastShownTimeKey[] = …;
const char kActivatedKey[] = …;
const char kNonRenewingExpiryTime[] = …;
const char kNonRenewingLifetimeKey[] = …;
bool ShouldUseSmartUI() { … }
}
constexpr base::TimeDelta
SubresourceFilterContentSettingsManager::kDelayBeforeShowingInfobarAgain;
constexpr base::TimeDelta
SubresourceFilterContentSettingsManager::kMaxPersistMetadataDuration;
SubresourceFilterContentSettingsManager::
SubresourceFilterContentSettingsManager(
HostContentSettingsMap* settings_map)
: … { … }
SubresourceFilterContentSettingsManager::
~SubresourceFilterContentSettingsManager() = default;
ContentSetting SubresourceFilterContentSettingsManager::GetSitePermission(
const GURL& url) const { … }
void SubresourceFilterContentSettingsManager::AllowlistSite(const GURL& url) { … }
void SubresourceFilterContentSettingsManager::OnDidShowUI(const GURL& url) { … }
bool SubresourceFilterContentSettingsManager::ShouldShowUIForSite(
const GURL& url) const { … }
void SubresourceFilterContentSettingsManager::SetSiteMetadataBasedOnActivation(
const GURL& url,
bool is_activated,
ActivationSource activation_source,
std::optional<base::Value::Dict> additional_data) { … }
std::optional<base::Value::Dict>
SubresourceFilterContentSettingsManager::GetSiteMetadata(
const GURL& url) const { … }
void SubresourceFilterContentSettingsManager::SetSiteMetadataForTesting(
const GURL& url,
std::optional<base::Value::Dict> dict) { … }
void SubresourceFilterContentSettingsManager::SetSiteMetadata(
const GURL& url,
std::optional<base::Value::Dict> dict) { … }
base::Value::Dict
SubresourceFilterContentSettingsManager::CreateMetadataDictWithActivation(
bool is_activated) { … }
bool SubresourceFilterContentSettingsManager::ShouldDeleteDataWithNoActivation(
const std::optional<base::Value::Dict>& dict,
ActivationSource activation_source) { … }
bool SubresourceFilterContentSettingsManager::GetSiteActivationFromMetadata(
const GURL& url) { … }
void SubresourceFilterContentSettingsManager::ClearSiteMetadata(
const GURL& url) { … }
void SubresourceFilterContentSettingsManager::ClearMetadataForAllSites() { … }
}