chromium/chrome/browser/content_settings/one_time_permission_provider.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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() {}

// TODO(b/307193732): handle the PartitionKey in all relevant methods, including
// when we call NotifyObservers().
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() {}

// All tabs with the given origin have either been closed or navigated away
// from. We remove all permissions associated with the origin.
void OneTimePermissionProvider::OnLastPageFromOriginClosed(
    const url::Origin& origin) {}

// All tabs with the given origin have either been in the background for a
// certain time or not used for a certain time. This situation currently only
// expires geolocation. We remove the geolocation permission associated with
// the origin.
void OneTimePermissionProvider::OnAllTabsInBackgroundTimerExpired(
    const url::Origin& origin,
    const OneTimePermissionsTrackerObserver::BackgroundExpiryType&
        expiry_type) {}

// All tabs to the origin have not shown a tab indicator for video for a
// certain time and have been in the background. We remove the camera
// permission associated with the origin.
void OneTimePermissionProvider::OnCapturingVideoExpired(
    const url::Origin& origin) {}

// All tabs to the origin have not shown a tab indicator for microphone access
// for a certain time and have been in the background. We remove the
// microphone permission associated with the 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() {}