summaryrefslogtreecommitdiff
path: root/chromium/components/permissions/permission_context_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/permissions/permission_context_base.cc')
-rw-r--r--chromium/components/permissions/permission_context_base.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/chromium/components/permissions/permission_context_base.cc b/chromium/components/permissions/permission_context_base.cc
index 0d55900ad8e..0308b2e3ffc 100644
--- a/chromium/components/permissions/permission_context_base.cc
+++ b/chromium/components/permissions/permission_context_base.cc
@@ -75,6 +75,10 @@ const char kPermissionBlockedFeaturePolicyMessage[] =
"%s permission has been blocked because of a Feature Policy applied to the "
"current document. See https://goo.gl/EuHzyv for more details.";
+const char kPermissionBlockedPortalsMessage[] =
+ "%s permission has been blocked because it was requested inside a portal. "
+ "Portals don't currently support permission requests.";
+
void LogPermissionBlockedMessage(content::WebContents* web_contents,
const char* message,
ContentSettingsType type) {
@@ -164,6 +168,11 @@ void PermissionContextBase::RequestPermission(
kPermissionBlockedFeaturePolicyMessage,
content_settings_type_);
break;
+ case PermissionStatusSource::PORTAL:
+ LogPermissionBlockedMessage(web_contents,
+ kPermissionBlockedPortalsMessage,
+ content_settings_type_);
+ break;
case PermissionStatusSource::INSECURE_ORIGIN:
case PermissionStatusSource::UNSPECIFIED:
case PermissionStatusSource::VIRTUAL_URL_DIFFERENT_ORIGIN:
@@ -231,6 +240,12 @@ PermissionResult PermissionContextBase::GetPermissionStatus(
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
+ // Permissions are denied for portals.
+ if (web_contents && web_contents->IsPortal()) {
+ return PermissionResult(CONTENT_SETTING_BLOCK,
+ PermissionStatusSource::PORTAL);
+ }
+
// Automatically deny all HTTP or HTTPS requests where the virtual URL and
// the loaded URL are for different origins. The loaded URL is the one
// actually in the renderer, but the virtual URL is the one