#include "chrome/browser/content_settings/one_time_permission_provider.h"
#include <memory>
#include <set>
#include "base/power_monitor/power_monitor.h"
#include "base/ranges/algorithm.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/permissions/one_time_permissions_tracker.h"
#include "chrome/browser/permissions/one_time_permissions_tracker_factory.h"
#include "chrome/browser/permissions/one_time_permissions_tracker_observer.h"
#include "components/content_settings/core/browser/content_settings_registry.h"
#include "components/content_settings/core/browser/content_settings_rule.h"
#include "components/content_settings/core/browser/user_modifiable_provider.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_partition_key.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "components/content_settings/core/common/features.h"
#include "components/permissions/permission_uma_util.h"
#include "components/permissions/permission_util.h"
#include "url/gurl.h"
OneTimePermissionProvider::OneTimePermissionProvider(
OneTimePermissionsTracker* one_time_permissions_tracker)
: … { … }
OneTimePermissionProvider::~OneTimePermissionProvider() { … }
std::unique_ptr<content_settings::RuleIterator>
OneTimePermissionProvider::GetRuleIterator(
ContentSettingsType content_type,
bool incognito,
const content_settings::PartitionKey& partition_key) const { … }
std::unique_ptr<content_settings::Rule> OneTimePermissionProvider::GetRule(
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsType content_type,
bool off_the_record,
const content_settings::PartitionKey& partition_key) const { … }
bool OneTimePermissionProvider::SetWebsiteSetting(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_settings_type,
base::Value&& value,
const content_settings::ContentSettingConstraints& constraints,
const content_settings::PartitionKey& partition_key) { … }
bool OneTimePermissionProvider::UpdateLastUsedTime(
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsType content_type,
const base::Time time,
const content_settings::PartitionKey& partition_key) { … }
bool OneTimePermissionProvider::ResetLastVisitTime(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type,
const content_settings::PartitionKey& partition_key) { … }
bool OneTimePermissionProvider::UpdateLastVisitTime(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type,
const content_settings::PartitionKey& partition_key) { … }
std::optional<base::TimeDelta> OneTimePermissionProvider::RenewContentSetting(
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsType type,
std::optional<ContentSetting> setting_to_match,
const content_settings::PartitionKey& partition_key) { … }
void OneTimePermissionProvider::ClearAllContentSettingsRules(
ContentSettingsType content_type,
const content_settings::PartitionKey& partition_key) { … }
void OneTimePermissionProvider::ShutdownOnUIThread() { … }
void OneTimePermissionProvider::SetClockForTesting(base::Clock* clock) { … }
void OneTimePermissionProvider::ExpireWebsiteSetting(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_settings_type,
const content_settings::PartitionKey& partition_key) { … }
void OneTimePermissionProvider::OnSuspend() { … }
void OneTimePermissionProvider::OnLastPageFromOriginClosed(
const url::Origin& origin) { … }
void OneTimePermissionProvider::OnAllTabsInBackgroundTimerExpired(
const url::Origin& origin,
const OneTimePermissionsTrackerObserver::BackgroundExpiryType&
expiry_type) { … }
void OneTimePermissionProvider::OnCapturingVideoExpired(
const url::Origin& origin) { … }
void OneTimePermissionProvider::OnCapturingAudioExpired(
const url::Origin& origin) { … }
void OneTimePermissionProvider::DeleteEntriesAndNotify(
const std::vector<OneTimePermissionProvider::ContentSettingEntry>&
entries_to_delete) { … }
void OneTimePermissionProvider::DeleteEntriesMatchingGURL(
ContentSettingsType content_setting_type,
const GURL& origin_gurl,
permissions::OneTimePermissionEvent trigger_event) { … }
void OneTimePermissionProvider::OnShutdown() { … }