#include "chrome/browser/ui/safety_hub/abusive_notification_permissions_manager.h"
#include "base/time/default_clock.h"
#include "chrome/browser/ui/safety_hub/safety_hub_util.h"
#include "components/content_settings/core/browser/content_settings_uma_util.h"
#include "components/content_settings/core/common/features.h"
#include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h"
#include "content/public/browser/browser_thread.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace {
void UpdateNotificationPermission(HostContentSettingsMap* hcsm,
GURL url,
ContentSetting setting_value) { … }
}
AbusiveNotificationPermissionsManager::AbusiveNotificationPermissionsManager(
scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager,
scoped_refptr<HostContentSettingsMap> hcsm)
: … { … }
AbusiveNotificationPermissionsManager::
~AbusiveNotificationPermissionsManager() = default;
void AbusiveNotificationPermissionsManager::
CheckNotificationPermissionOrigins() { … }
void AbusiveNotificationPermissionsManager::
RegrantPermissionForOriginIfNecessary(const GURL& url) { … }
void AbusiveNotificationPermissionsManager::
UndoRegrantPermissionForOriginIfNecessary(
const GURL& url,
std::set<ContentSettingsType> permission_types,
content_settings::ContentSettingConstraints constraints) { … }
void AbusiveNotificationPermissionsManager::ClearRevokedPermissionsList() { … }
void AbusiveNotificationPermissionsManager::
DeletePatternFromRevokedAbusiveNotificationList(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern) { … }
const base::Clock* AbusiveNotificationPermissionsManager::GetClock() { … }
bool AbusiveNotificationPermissionsManager::IsRevocationRunning() { … }
AbusiveNotificationPermissionsManager::SafeBrowsingCheckClient::
SafeBrowsingCheckClient(
safe_browsing::SafeBrowsingDatabaseManager* database_manager,
raw_ptr<std::map<SafeBrowsingCheckClient*,
std::unique_ptr<SafeBrowsingCheckClient>>>
safe_browsing_request_clients,
raw_ptr<HostContentSettingsMap> hcsm,
GURL url,
int safe_browsing_check_delay,
const base::Clock* clock)
: … { … }
AbusiveNotificationPermissionsManager::SafeBrowsingCheckClient::
~SafeBrowsingCheckClient() { … }
void AbusiveNotificationPermissionsManager::SafeBrowsingCheckClient::
CheckSocialEngineeringBlocklist() { … }
void AbusiveNotificationPermissionsManager::SafeBrowsingCheckClient::
OnCheckBrowseUrlResult(const GURL& url,
safe_browsing::SBThreatType threat_type,
const safe_browsing::ThreatMetadata& metadata) { … }
void AbusiveNotificationPermissionsManager::SafeBrowsingCheckClient::
OnCheckBlocklistTimeout() { … }
void AbusiveNotificationPermissionsManager::PerformSafeBrowsingChecks(
GURL url) { … }
bool AbusiveNotificationPermissionsManager::ShouldCheckOrigin(
const ContentSettingPatternSource& setting) const { … }
void AbusiveNotificationPermissionsManager::ResetSafeBrowsingCheckHelpers() { … }