electron/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
3.5 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Rose <japthorp@slack-corp.com>
Date: Tue, 12 Jul 2022 16:51:43 -0700
Subject: short-circuit permissions checks in MediaStreamDevicesController
The //components/permissions architecture is complicated and not that
widely used in Chromium, and mostly oriented around showing permissions
UI and/or remembering per-site permissions, which we're not interested
in.
Since we do a permissions check prior to invoking the
MediaStreamDevicesController, and don't (yet) provide the ability to set
granular permissions (e.g. allow video but not audio), just
short-circuit all the permissions checks in MSDC for now to allow us to
unduplicate this code.
diff --git a/components/webrtc/media_stream_devices_controller.cc b/components/webrtc/media_stream_devices_controller.cc
index 13bbeaac938b27446d5b62eb92ca761487db5fef..4cfe57a6356bbc2492f59957a0dfcf63052b7ee8 100644
--- a/components/webrtc/media_stream_devices_controller.cc
+++ b/components/webrtc/media_stream_devices_controller.cc
@@ -93,11 +93,14 @@ void MediaStreamDevicesController::RequestPermissions(
std::vector<blink::PermissionType> permission_types;
+#if 0
permissions::PermissionManager* permission_manager =
permissions::PermissionsClient::Get()->GetPermissionManager(
web_contents->GetBrowserContext());
+#endif
if (controller->ShouldRequestAudio()) {
+#if 0
permissions::PermissionResult permission_status =
permission_manager->GetPermissionStatusForCurrentDocument(
ContentSettingsType::MEDIASTREAM_MIC, rfh);
@@ -109,10 +112,12 @@ void MediaStreamDevicesController::RequestPermissions(
permissions::PermissionStatusSource::FEATURE_POLICY);
return;
}
+#endif
permission_types.push_back(blink::PermissionType::AUDIO_CAPTURE);
}
if (controller->ShouldRequestVideo()) {
+#if 0
permissions::PermissionResult permission_status =
permission_manager->GetPermissionStatusForCurrentDocument(
ContentSettingsType::MEDIASTREAM_CAMERA, rfh);
@@ -124,6 +129,7 @@ void MediaStreamDevicesController::RequestPermissions(
permissions::PermissionStatusSource::FEATURE_POLICY);
return;
}
+#endif
permission_types.push_back(blink::PermissionType::VIDEO_CAPTURE);
@@ -135,6 +141,7 @@ void MediaStreamDevicesController::RequestPermissions(
// pan-tilt-zoom permission and there are suitable PTZ capable devices
// available.
if (request.request_pan_tilt_zoom_permission && has_pan_tilt_zoom_camera) {
+#if 0
permission_status =
permission_manager->GetPermissionStatusForCurrentDocument(
ContentSettingsType::CAMERA_PAN_TILT_ZOOM, rfh);
@@ -144,6 +151,7 @@ void MediaStreamDevicesController::RequestPermissions(
controller->RunCallback(/*blocked_by_permissions_policy=*/false);
return;
}
+#endif
permission_types.push_back(blink::PermissionType::CAMERA_PAN_TILT_ZOOM);
}
@@ -417,6 +425,7 @@ bool MediaStreamDevicesController::PermissionIsBlockedForReason(
if (rfh->GetLastCommittedOrigin().GetURL() != request_.security_origin) {
return false;
}
+#if 0
permissions::PermissionResult result =
permissions::PermissionsClient::Get()
->GetPermissionManager(web_contents_->GetBrowserContext())
@@ -425,6 +434,7 @@ bool MediaStreamDevicesController::PermissionIsBlockedForReason(
DCHECK_EQ(CONTENT_SETTING_BLOCK, result.content_setting);
return true;
}
+#endif
return false;
}