| Index: chrome/browser/extensions/extension_host.cc
|
| diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
|
| index d370c268c555b51ae652538ac323cac0c26de36b..53666cdd99e4af4095174931245228ff52ab94f2 100644
|
| --- a/chrome/browser/extensions/extension_host.cc
|
| +++ b/chrome/browser/extensions/extension_host.cc
|
| @@ -640,4 +640,35 @@ void ExtensionHost::RenderViewReady() {
|
| content::Details<ExtensionHost>(this));
|
| }
|
|
|
| +void ExtensionHost::RequestMediaAccessPermission(
|
| + content::WebContents* web_contents,
|
| + const content::MediaStreamRequest* request,
|
| + const content::MediaResponseCallback& callback) {
|
| + content::MediaStreamDevices devices;
|
| +
|
| + bool accepted_an_audio_device = false;
|
| + bool accepted_a_video_device = false;
|
| + for (content::MediaStreamDeviceMap::const_iterator it =
|
| + request->devices.begin(); it != request->devices.end(); ++it) {
|
| + if (!accepted_an_audio_device && content::IsAudioMediaType(it->first) &&
|
| + !it->second.empty()) {
|
| + // For tab capture, we require the tabCapture permission.
|
| + if (it->first != content::MEDIA_TAB_AUDIO_CAPTURE ||
|
| + extension()->HasAPIPermission(APIPermission::kTabCapture)) {
|
| + devices.push_back(it->second.front());
|
| + accepted_an_audio_device = true;
|
| + }
|
| + } else if (!accepted_a_video_device &&
|
| + content::IsVideoMediaType(it->first) && !it->second.empty()) {
|
| + if (it->first != content::MEDIA_TAB_VIDEO_CAPTURE ||
|
| + extension()->HasAPIPermission(APIPermission::kTabCapture)) {
|
| + devices.push_back(it->second.front());
|
| + accepted_a_video_device = true;
|
| + }
|
| + }
|
| + }
|
| +
|
| + callback.Run(devices);
|
| +}
|
| +
|
| } // namespace extensions
|
|
|