chromium/components/permissions/permission_util.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/permissions/permission_util.h"

#include "base/check.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/permissions/features.h"
#include "components/permissions/permission_request.h"
#include "components/permissions/permissions_client.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/permission_result.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"

PermissionType;

namespace permissions {

namespace {
// Represents the possible methods of delegating permissions from main frames
// to child frames.
enum class PermissionDelegationMode {};

PermissionDelegationMode GetPermissionDelegationMode(
    ContentSettingsType permission) {}

#if BUILDFLAG(IS_ANDROID)
constexpr const char* kIsFileURLHistogram =
    "Permissions.GetLastCommittedOriginAsURL.IsFileURL";
#endif
}  // namespace

// The returned strings must match any Field Trial configs for the Permissions
// kill switch e.g. Permissions.Action.Geolocation etc..
std::string PermissionUtil::GetPermissionString(
    ContentSettingsType content_type) {}

PermissionRequestGestureType PermissionUtil::GetGestureType(bool user_gesture) {}

std::optional<blink::mojom::PermissionsPolicyFeature>
PermissionUtil::GetPermissionsPolicyFeature(ContentSettingsType permission) {}

bool PermissionUtil::GetPermissionType(ContentSettingsType type,
                                       PermissionType* out) {}

bool PermissionUtil::IsPermission(ContentSettingsType type) {}

bool PermissionUtil::IsLowPriorityPermissionRequest(
    const PermissionRequest* request) {}

bool PermissionUtil::IsGuardContentSetting(ContentSettingsType type) {}

bool PermissionUtil::DoesSupportTemporaryGrants(ContentSettingsType type) {}

bool PermissionUtil::DoesStoreTemporaryGrantsInHcsm(ContentSettingsType type) {}

// Due to dependency issues, this method is duplicated in
// content/browser/permissions/permission_util.cc.
GURL PermissionUtil::GetLastCommittedOriginAsURL(
    content::RenderFrameHost* render_frame_host) {}

ContentSettingsType PermissionUtil::PermissionTypeToContentSettingTypeSafe(
    PermissionType permission) {}

ContentSettingsType PermissionUtil::PermissionTypeToContentSettingType(
    PermissionType permission) {}

PermissionType PermissionUtil::ContentSettingTypeToPermissionType(
    ContentSettingsType permission) {}

ContentSetting PermissionUtil::PermissionStatusToContentSetting(
    blink::mojom::PermissionStatus status) {}

blink::mojom::PermissionStatus PermissionUtil::ContentSettingToPermissionStatus(
    ContentSetting setting) {}

bool PermissionUtil::IsPermissionBlockedInPartition(
    ContentSettingsType permission,
    const GURL& requesting_origin,
    content::RenderProcessHost* render_process_host) {}

GURL PermissionUtil::GetCanonicalOrigin(ContentSettingsType permission,
                                        const GURL& requesting_origin,
                                        const GURL& embedding_origin) {}

bool PermissionUtil::HasUserGesture(PermissionPrompt::Delegate* delegate) {}

bool PermissionUtil::CanPermissionRequestIgnoreStatus(
    const PermissionRequestData& request,
    content::PermissionStatusSource source) {}

// static
bool PermissionUtil::DoesPlatformSupportChip() {}

}  // namespace permissions