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

Unified Diff: chrome/browser/extensions/extension_host.cc

Issue 11198044: Make tab capture media stream requests verify that the request came from extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years, 2 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/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) &&
no longer working on chromium 2012/10/18 08:36:17 fix the alignment to help readability. If (*** &&
justinlin 2012/10/18 09:33:29 Done.
+ !it->second.empty()) {
+ // For tab capture, we require the tabCapture permission.
+ if (it->first != content::MEDIA_TAB_AUDIO_CAPTURE ||
no longer working on chromium 2012/10/18 08:36:17 I don't understand here, shouldn't it be it->first
justinlin 2012/10/18 09:33:29 Sorry if this is confusing. We add the device if i
+ 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

Powered by Google App Engine
This is Rietveld 408576698