Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1442)

Unified Diff: chrome/browser/media/webrtc/media_permission.cc

Issue 2728573002: Hoist device logic out of permissions check in MediaStreamDevicesController (Closed)
Patch Set: Hoist device logic out of permissions check in MediaStreamDevicesController Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/webrtc/media_permission.cc
diff --git a/chrome/browser/media/webrtc/media_permission.cc b/chrome/browser/media/webrtc/media_permission.cc
index 13b3dcafa73d0899a8155179a12f26714687fd1e..b330bdf238c4f0b5c81b29e33bcbdac7793de8e9 100644
--- a/chrome/browser/media/webrtc/media_permission.cc
+++ b/chrome/browser/media/webrtc/media_permission.cc
@@ -115,45 +115,3 @@ ContentSetting MediaPermission::GetPermissionStatus(
*denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED;
return content_setting;
}
-
-ContentSetting MediaPermission::GetPermissionStatusWithDeviceRequired(
- const std::string& device_id,
- content::MediaStreamRequestResult* denial_reason) const {
- // Deny the request if there is no device attached to the OS of the requested
- // type.
- if (!HasAvailableDevices(device_id)) {
- *denial_reason = content::MEDIA_DEVICE_NO_HARDWARE;
- return CONTENT_SETTING_BLOCK;
- }
-
- return GetPermissionStatus(denial_reason);
-}
-
-bool MediaPermission::HasAvailableDevices(const std::string& device_id) const {
- const content::MediaStreamDevices* devices = nullptr;
- if (content_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
- devices =
- &MediaCaptureDevicesDispatcher::GetInstance()->GetAudioCaptureDevices();
- } else if (content_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) {
- devices =
- &MediaCaptureDevicesDispatcher::GetInstance()->GetVideoCaptureDevices();
- } else {
- NOTREACHED();
- }
-
- // TODO(tommi): It's kind of strange to have this here since if we fail this
- // test, there'll be a UI shown that indicates to the user that access to
- // non-existing audio/video devices has been denied. The user won't have
- // any way to change that but there will be a UI shown which indicates that
- // access is blocked.
- if (devices->empty())
- return false;
-
- // Note: we check device_id before dereferencing devices. If the requested
- // device id is non-empty, then the corresponding device list must not be
- // NULL.
- if (!device_id.empty() && !devices->FindById(device_id))
- return false;
-
- return true;
-}
« no previous file with comments | « chrome/browser/media/webrtc/media_permission.h ('k') | chrome/browser/media/webrtc/media_stream_devices_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698