Chromium Code Reviews| 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..d7874a94c564756e93679901faf3ec82a3060aa1 100644 |
| --- a/chrome/browser/extensions/extension_host.cc |
| +++ b/chrome/browser/extensions/extension_host.cc |
| @@ -640,4 +640,38 @@ void ExtensionHost::RenderViewReady() { |
| content::Details<ExtensionHost>(this)); |
| } |
| +void ExtensionHost::RequestMediaAccessPermission( |
|
Aaron Boodman
2012/10/18 22:14:09
This code looks like a dupe of the one in shell_ho
justinlin
2012/10/19 02:22:54
Done the refactor.
Are those implementations need
|
| + 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 device, we require the tabCapture permission, otherwise |
| + // we don't need to check 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 |