| Index: chrome/browser/media/media_capture_devices_dispatcher.cc
|
| diff --git a/chrome/browser/media/media_capture_devices_dispatcher.cc b/chrome/browser/media/media_capture_devices_dispatcher.cc
|
| index 2d0a798918b2803ed790b473fd37952f59e243d4..470310a2a4953ee2a878ac6b45ddd75f571b9657 100644
|
| --- a/chrome/browser/media/media_capture_devices_dispatcher.cc
|
| +++ b/chrome/browser/media/media_capture_devices_dispatcher.cc
|
| @@ -446,6 +446,56 @@ bool MediaCaptureDevicesDispatcher::CheckMediaAccessPermission(
|
| return false;
|
| }
|
|
|
| +bool MediaCaptureDevicesDispatcher::CheckMediaAccessPermission(
|
| + content::WebContents* web_contents,
|
| + const GURL& security_origin,
|
| + content::MediaStreamType type,
|
| + const extensions::Extension* extension) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + DCHECK(type == content::MEDIA_DEVICE_AUDIO_CAPTURE ||
|
| + type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
|
| +
|
| + if (extension && (extension->is_platform_app() ||
|
| + IsMediaRequestWhitelistedForExtension(extension))) {
|
| + return extension->permissions_data()->HasAPIPermission(
|
| + type == content::MEDIA_DEVICE_AUDIO_CAPTURE
|
| + ? extensions::APIPermission::kAudioCapture
|
| + : extensions::APIPermission::kVideoCapture);
|
| + }
|
| +
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
| +
|
| + if (CheckAllowAllMediaStreamContentForOrigin(profile, security_origin))
|
| + return true;
|
| +
|
| + const char* policy_name = type == content::MEDIA_DEVICE_AUDIO_CAPTURE
|
| + ? prefs::kAudioCaptureAllowed
|
| + : prefs::kVideoCaptureAllowed;
|
| + const char* list_policy_name = type == content::MEDIA_DEVICE_AUDIO_CAPTURE
|
| + ? prefs::kAudioCaptureAllowedUrls
|
| + : prefs::kVideoCaptureAllowedUrls;
|
| + if (GetDevicePolicy(
|
| + profile, security_origin, policy_name, list_policy_name) ==
|
| + ALWAYS_ALLOW) {
|
| + return true;
|
| + }
|
| +
|
| + // There's no secondary URL for these content types, hence duplicating
|
| + // |security_origin|.
|
| + if (profile->GetHostContentSettingsMap()->GetContentSetting(
|
| + security_origin,
|
| + security_origin,
|
| + type == content::MEDIA_DEVICE_AUDIO_CAPTURE
|
| + ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC
|
| + : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
|
| + NO_RESOURCE_IDENTIFIER) == CONTENT_SETTING_ALLOW) {
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| void MediaCaptureDevicesDispatcher::ProcessDesktopCaptureAccessRequest(
|
| content::WebContents* web_contents,
|
| const content::MediaStreamRequest& request,
|
|
|