#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 {
enum class PermissionDelegationMode { … };
PermissionDelegationMode GetPermissionDelegationMode(
ContentSettingsType permission) { … }
#if BUILDFLAG(IS_ANDROID)
constexpr const char* kIsFileURLHistogram =
"Permissions.GetLastCommittedOriginAsURL.IsFileURL";
#endif
}
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) { … }
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) { … }
bool PermissionUtil::DoesPlatformSupportChip() { … }
}