#include "components/permissions/permissions_client.h"
#include "base/functional/callback.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/permissions/permission_request_enums.h"
#include "components/permissions/permission_uma_util.h"
#include "content/public/browser/web_contents.h"
#if !BUILDFLAG(IS_ANDROID)
#include "ui/gfx/paint_vector_icon.h"
#endif
namespace permissions {
namespace {
PermissionsClient* g_client = …;
}
PermissionsClient::PermissionsClient() { … }
PermissionsClient::~PermissionsClient() { … }
PermissionsClient* PermissionsClient::Get() { … }
double PermissionsClient::GetSiteEngagementScore(
content::BrowserContext* browser_context,
const GURL& origin) { … }
void PermissionsClient::AreSitesImportant(
content::BrowserContext* browser_context,
std::vector<std::pair<url::Origin, bool>>* origins) { … }
bool PermissionsClient::IsCookieDeletionDisabled(
content::BrowserContext* browser_context,
const GURL& origin) { … }
void PermissionsClient::GetUkmSourceId(ContentSettingsType permission_type,
content::BrowserContext* browser_context,
content::WebContents* web_contents,
const GURL& requesting_origin,
GetUkmSourceIdCallback callback) { … }
IconId PermissionsClient::GetOverrideIconId(RequestType request_type) { … }
std::vector<std::unique_ptr<PermissionUiSelector>>
PermissionsClient::CreatePermissionUiSelectors(
content::BrowserContext* browser_context) { … }
void PermissionsClient::TriggerPromptHatsSurveyIfEnabled(
content::WebContents* web_contents,
permissions::RequestType request_type,
std::optional<permissions::PermissionAction> action,
permissions::PermissionPromptDisposition prompt_disposition,
permissions::PermissionPromptDispositionReason prompt_disposition_reason,
permissions::PermissionRequestGestureType gesture_type,
std::optional<base::TimeDelta> prompt_display_duration,
bool is_post_prompt,
const GURL& gurl,
std::optional<permissions::feature_params::PermissionElementPromptPosition>
pepc_prompt_position,
ContentSetting initial_permission_status,
base::OnceCallback<void()> hats_shown_callback_) { … }
void PermissionsClient::OnPromptResolved(
RequestType request_type,
PermissionAction action,
const GURL& origin,
PermissionPromptDisposition prompt_disposition,
PermissionPromptDispositionReason prompt_disposition_reason,
PermissionRequestGestureType gesture_type,
std::optional<QuietUiReason> quiet_ui_reason,
base::TimeDelta prompt_display_duration,
std::optional<permissions::feature_params::PermissionElementPromptPosition>
pepc_prompt_position,
ContentSetting initial_permission_status,
content::WebContents* web_contents) { … }
std::optional<bool>
PermissionsClient::HadThreeConsecutiveNotificationPermissionDenies(
content::BrowserContext* browser_context) { … }
std::optional<url::Origin> PermissionsClient::GetAutoApprovalOrigin(
content::BrowserContext* browser_context) { … }
std::optional<PermissionAction> PermissionsClient::GetAutoApprovalStatus(
content::BrowserContext* browser_context,
const GURL& origin) { … }
std::optional<bool> PermissionsClient::HasPreviouslyAutoRevokedPermission(
content::BrowserContext* browser_context,
const GURL& origin,
ContentSettingsType permission) { … }
bool PermissionsClient::CanBypassEmbeddingOriginCheck(
const GURL& requesting_origin,
const GURL& embedding_origin) { … }
std::optional<GURL> PermissionsClient::OverrideCanonicalOrigin(
const GURL& requesting_origin,
const GURL& embedding_origin) { … }
bool PermissionsClient::DoURLsMatchNewTabPage(const GURL& requesting_origin,
const GURL& embedding_origin) { … }
permissions::PermissionIgnoredReason PermissionsClient::DetermineIgnoreReason(
content::WebContents* web_contents) { … }
#if BUILDFLAG(IS_ANDROID)
bool PermissionsClient::IsDseOrigin(content::BrowserContext* browser_context,
const url::Origin& origin) {
return false;
}
infobars::InfoBarManager* PermissionsClient::GetInfoBarManager(
content::WebContents* web_contents) {
return nullptr;
}
infobars::InfoBar* PermissionsClient::MaybeCreateInfoBar(
content::WebContents* web_contents,
ContentSettingsType type,
base::WeakPtr<PermissionPromptAndroid> prompt) {
return nullptr;
}
std::unique_ptr<PermissionsClient::PermissionMessageDelegate>
PermissionsClient::MaybeCreateMessageUI(
content::WebContents* web_contents,
ContentSettingsType type,
base::WeakPtr<PermissionPromptAndroid> prompt) {
return nullptr;
}
void PermissionsClient::RepromptForAndroidPermissions(
content::WebContents* web_contents,
const std::vector<ContentSettingsType>& content_settings_types,
const std::vector<ContentSettingsType>& filtered_content_settings_types,
const std::vector<std::string>& required_permissions,
const std::vector<std::string>& optional_permissions,
PermissionsUpdatedCallback callback) {
std::move(callback).Run(false);
}
int PermissionsClient::MapToJavaDrawableId(int resource_id) {
return 0;
}
#else
std::unique_ptr<PermissionPrompt> PermissionsClient::CreatePrompt(
content::WebContents* web_contents,
PermissionPrompt::Delegate* delegate) { … }
#endif
bool PermissionsClient::HasDevicePermission(ContentSettingsType type) const { … }
bool PermissionsClient::CanRequestDevicePermission(
ContentSettingsType type) const { … }
favicon::FaviconService* PermissionsClient::GetFaviconService(
content::BrowserContext* browser_context) { … }
}