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

Unified Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 11451006: Make TabCapture requests use the target render process and render view id's for UI permissions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the bug too.. Created 8 years 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/media_stream_devices_controller.cc
diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc
index f0e3a3f4a82ffd2e4e5bf4e58f45f3ffd5927b0c..f362d669a827ec8f992b738445fde166462e4a91 100644
--- a/chrome/browser/media/media_stream_devices_controller.cc
+++ b/chrome/browser/media/media_stream_devices_controller.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/media/media_stream_devices_controller.h"
+#include "base/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/content_settings/content_settings_provider.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
@@ -56,7 +57,30 @@ MediaStreamDevicesController::~MediaStreamDevicesController() {}
bool MediaStreamDevicesController::DismissInfoBarAndTakeActionOnSettings() {
if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE ||
request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) {
- Accept(false);
+ extensions::TabCaptureRegistry* registry =
+ extensions::TabCaptureRegistryFactory::GetForProfile(profile_);
+
+ std::string device_id = base::StringPrintf(
+ "%i:%i", request_.render_process_id, request_.render_view_id);
no longer working on chromium 2012/12/05 17:38:37 this code looks a bit odd, can you consider change
+
+ if (!registry->VerifyRequest(device_id)) {
+ Deny();
+ } else {
+ content::MediaStreamDevices devices;
+
+ if (request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) {
+ devices.push_back(content::MediaStreamDevice(
+ content::MEDIA_TAB_VIDEO_CAPTURE, "", ""));
+ }
+ if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE) {
+ devices.push_back(content::MediaStreamDevice(
+ content::MEDIA_TAB_AUDIO_CAPTURE, "", ""));
+ }
+
+ callback_.Run(devices);
+ }
+
+ return true;
}
// Deny the request if the security origin is empty, this happens with

Powered by Google App Engine
This is Rietveld 408576698