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

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

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

#include <stddef.h>

#include <vector>

#include "base/notreached.h"
#include "base/strings/string_split.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/content_settings/core/browser/content_settings_registry.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_types.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "components/content_settings/core/common/features.h"

namespace {

const char kPatternSeparator[] =;

struct ContentSettingsStringMapping {};
const ContentSettingsStringMapping kContentSettingsStringMapping[] =;
static_assert;

// Content settings sorted from most to least permissive. The order is chosen
// to check if a permission grants more rights than another. This is intuitive
// for ALLOW, ASK and BLOCK. SESSION_ONLY and DETECT_IMPORTANT_CONTENT are never
// used in the same setting so their respective order is not important but both
// belong between ALLOW and ASK. DEFAULT should never be used and is therefore
// not part of this array.
const ContentSetting kContentSettingOrder[] =;

static_assert;

}  // namespace

namespace content_settings {

std::string ContentSettingToString(ContentSetting setting) {}

bool ContentSettingFromString(const std::string& name,
                              ContentSetting* setting) {}

std::string CreatePatternString(
    const ContentSettingsPattern& item_pattern,
    const ContentSettingsPattern& top_level_frame_pattern) {}

PatternPair ParsePatternString(const std::string& pattern_str) {}

void GetRendererContentSettingRules(const HostContentSettingsMap* map,
                                    RendererContentSettingRules* rules) {}

bool IsMorePermissive(ContentSetting a, ContentSetting b) {}

// Currently only mojom::SessionModel::DURABLE constraints need to be persistent
// as they are only bounded by time and can persist through multiple browser
// sessions.
bool IsConstraintPersistent(const ContentSettingConstraints& constraints) {}

bool CanTrackLastVisit(ContentSettingsType type) {}

base::Time GetCoarseVisitedTime(base::Time time) {}

base::TimeDelta GetCoarseVisitedTimePrecision() {}

bool CanBeAutoRevoked(ContentSettingsType type,
                      ContentSetting setting,
                      bool is_one_time) {}

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

bool IsChooserPermissionEligibleForAutoRevocation(ContentSettingsType type) {}

bool IsGrantedByRelatedWebsiteSets(ContentSettingsType type,
                                   const RuleMetaData& metadata) {}

const std::vector<ContentSettingsType>& GetTypesWithTemporaryGrants() {}

const std::vector<ContentSettingsType>& GetTypesWithTemporaryGrantsInHcsm() {}

}  // namespace content_settings