2022-07-20 08:09:14 +00:00
|
|
|
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
|
2022-10-17 14:22:24 +00:00
|
|
|
index 7dbbcc13901dcd8b7a9ca9c9bdce4f924c1c6a55..5de44c5c20c92a1793060492f925519d6b8befe5 100644
|
2022-07-20 08:09:14 +00:00
|
|
|
--- a/components/webrtc/media_stream_devices_controller.cc
|
|
|
|
+++ b/components/webrtc/media_stream_devices_controller.cc
|
2022-09-07 07:46:37 +00:00
|
|
|
@@ -92,10 +92,13 @@ void MediaStreamDevicesController::RequestPermissions(
|
2022-07-20 08:09:14 +00:00
|
|
|
|
|
|
|
std::vector<blink::PermissionType> permission_types;
|
|
|
|
|
|
|
|
+#if 0
|
2022-09-07 07:46:37 +00:00
|
|
|
content::PermissionController* permission_controller =
|
|
|
|
web_contents->GetBrowserContext()->GetPermissionController();
|
2022-07-20 08:09:14 +00:00
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (controller->ShouldRequestAudio()) {
|
|
|
|
+#if 0
|
2022-09-07 07:46:37 +00:00
|
|
|
content::PermissionResult permission_status =
|
|
|
|
permission_controller->GetPermissionResultForCurrentDocument(
|
|
|
|
blink::PermissionType::AUDIO_CAPTURE, rfh);
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -110,10 +113,12 @@ void MediaStreamDevicesController::RequestPermissions(
|
|
|
|
content::PermissionStatusSource::FENCED_FRAME);
|
2022-07-20 08:09:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
permission_types.push_back(blink::PermissionType::AUDIO_CAPTURE);
|
|
|
|
}
|
|
|
|
if (controller->ShouldRequestVideo()) {
|
|
|
|
+#if 0
|
2022-09-07 07:46:37 +00:00
|
|
|
content::PermissionResult permission_status =
|
|
|
|
permission_controller->GetPermissionResultForCurrentDocument(
|
|
|
|
blink::PermissionType::VIDEO_CAPTURE, rfh);
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -128,6 +133,7 @@ void MediaStreamDevicesController::RequestPermissions(
|
|
|
|
content::PermissionStatusSource::FENCED_FRAME);
|
2022-07-20 08:09:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
permission_types.push_back(blink::PermissionType::VIDEO_CAPTURE);
|
|
|
|
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -139,6 +145,7 @@ void MediaStreamDevicesController::RequestPermissions(
|
2022-07-20 08:09:14 +00:00
|
|
|
// 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 =
|
2022-09-07 07:46:37 +00:00
|
|
|
permission_controller->GetPermissionResultForCurrentDocument(
|
|
|
|
blink::PermissionType::CAMERA_PAN_TILT_ZOOM, rfh);
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -148,6 +155,7 @@ void MediaStreamDevicesController::RequestPermissions(
|
2022-07-20 08:09:14 +00:00
|
|
|
controller->RunCallback(/*blocked_by_permissions_policy=*/false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
permission_types.push_back(blink::PermissionType::CAMERA_PAN_TILT_ZOOM);
|
|
|
|
}
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -434,6 +442,7 @@ bool MediaStreamDevicesController::PermissionIsBlockedForReason(
|
2022-07-20 08:09:14 +00:00
|
|
|
return false;
|
|
|
|
}
|
2022-09-07 07:46:37 +00:00
|
|
|
|
2022-07-20 08:09:14 +00:00
|
|
|
+#if 0
|
2022-09-07 07:46:37 +00:00
|
|
|
// TODO(raymes): This function wouldn't be needed if
|
|
|
|
// PermissionManager::RequestPermissions returned a denial reason.
|
|
|
|
content::PermissionResult result =
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -444,6 +453,7 @@ bool MediaStreamDevicesController::PermissionIsBlockedForReason(
|
2022-09-07 07:46:37 +00:00
|
|
|
DCHECK_EQ(blink::mojom::PermissionStatus::DENIED, result.status);
|
2022-07-20 08:09:14 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|