chromium/components/content_settings/core/browser/content_settings_pref.cc

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

#include "components/content_settings/core/browser/content_settings_pref.h"

#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/auto_reset.h"
#include "base/functional/bind.h"
#include "base/json/values_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/content_settings/core/browser/content_settings_info.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/content_settings_utils.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_partition_key.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "components/content_settings/core/common/features.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "services/preferences/public/cpp/dictionary_value_update.h"
#include "services/preferences/public/cpp/scoped_pref_update.h"
#include "url/gurl.h"

namespace {

const char kExpirationKey[] =;
const char kLastUsedKey[] =;
const char kLastVisitKey[] =;
const char kSessionModelKey[] =;
const char kSettingKey[] =;
const char kLastModifiedKey[] =;
const char kLifetimeKey[] =;
const char kDecidedByRelatedWebsiteSets[] =;

const base::TimeDelta kLastUsedPermissionExpiration =;

bool IsValueAllowedForType(const base::Value& value, ContentSettingsType type) {}

// Extract a timestamp from `dict[key]`.
// Will return base::Time() if no timestamp exists.
base::Time GetTimeFromDictKey(const base::Value::Dict& dict,
                              const std::string& key) {}

// Extract a timestamp from `dict[key]`.
// Will return base::Time() if no timestamp exists.
base::TimeDelta GetTimeDeltaFromDictKey(const base::Value::Dict& dict,
                                        const std::string& key) {}

// Extract a timestamp from `dictionary[kLastModifiedKey]`.
// Will return base::Time() if no timestamp exists.
base::Time GetLastModified(const base::Value::Dict& dictionary) {}

// Extract a timestamp from `dictionary[kExpirationKey]`.
// Will return base::Time() if no timestamp exists.
base::Time GetExpiration(const base::Value::Dict& dictionary) {}

// Extract a timestamp from `dictionary[kLastUsedKey]`.
// Will return base::Time() if no timestamp exists.
base::Time GetLastUsed(const base::Value::Dict& dictionary) {}

// Extract a timestamp from `dictionary[kLastVisit]`.
// Will return base::Time() if no timestamp exists.
base::Time GetLastVisit(const base::Value::Dict& dictionary) {}

// Extract a TimeDelta from `dictionary[kLifetimeKey]`.
// Will return base::TimeDelta() if no value exists for that key.
base::TimeDelta GetLifetime(const base::Value::Dict& dictionary) {}

// Extract a bool from `dictionary[kDecidedByRelatedWebsiteSets]`.
// Will return false if no value exists for that key.
bool GetDecidedByRelatedWebsiteSets(const base::Value::Dict& dictionary) {}

// Extract a SessionModel from |dictionary[kSessionModelKey]|. Will return
// SessionModel::DURABLE if no model exists.
content_settings::mojom::SessionModel GetSessionModel(
    const base::Value::Dict& dictionary) {}

}  // namespace

namespace content_settings {

ContentSettingsPref::ContentSettingsPref(
    ContentSettingsType content_type,
    PrefService* prefs,
    PrefChangeRegistrar* registrar,
    const std::string& pref_name,
    const std::string& partitioned_pref_name,
    bool off_the_record,
    bool restore_session,
    NotifyObserversCallback notify_callback)
    :{}

ContentSettingsPref::~ContentSettingsPref() = default;

std::unique_ptr<RuleIterator> ContentSettingsPref::GetRuleIterator(
    bool off_the_record,
    const PartitionKey& partition_key) const {}

std::unique_ptr<Rule> ContentSettingsPref::GetRule(
    const GURL& primary_url,
    const GURL& secondary_url,
    bool off_the_record,
    const PartitionKey& partition_key) const {}

void ContentSettingsPref::SetWebsiteSetting(
    const ContentSettingsPattern& primary_pattern,
    const ContentSettingsPattern& secondary_pattern,
    base::Value value,
    const RuleMetaData& metadata,
    const PartitionKey& partition_key) {}

void ContentSettingsPref::ClearAllContentSettingsRules(
    const PartitionKey& partition_key) {}

void ContentSettingsPref::OnShutdown() {}

size_t ContentSettingsPref::GetNumExceptions() {}

bool ContentSettingsPref::TryLockForTesting() const {}

void ContentSettingsPref::ReadContentSettingsFromPref() {}

void ContentSettingsPref::ReadContentSettingsFromPrefForPartition(
    const PartitionKey& partition_key,
    const base::Value::Dict& partition,
    prefs::DictionaryValueUpdate* mutable_partition) {}

bool ContentSettingsPref::ShouldRemoveSetting(
    base::Time expiration,
    content_settings::mojom::SessionModel session_model) {}

void ContentSettingsPref::OnPrefChanged() {}

void ContentSettingsPref::UpdatePref(
    const ContentSettingsPattern& primary_pattern,
    const ContentSettingsPattern& secondary_pattern,
    base::Value value,
    const RuleMetaData& metadata,
    const PartitionKey& partition_key) {}

void ContentSettingsPref::AssertLockNotHeld() const {}

void ContentSettingsPref::SetClockForTesting(base::Clock* clock) {}

}  // namespace content_settings