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

Unified Diff: chrome/browser/ui/extensions/shell_window.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: rebase 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
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/extensions/shell_window.cc
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index 4b61960e88b718f8c1734af3020e978f1c683e07..aa001026dd4d7704eac6ffde39cfc0e50b2e57b3 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -28,6 +28,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_messages.h"
+#include "chrome/common/extensions/request_media_access_permission_helper.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/invalidate_type.h"
#include "content/public/browser/navigation_entry.h"
@@ -52,6 +53,7 @@ using content::ResourceDispatcherHost;
using content::SiteInstance;
using content::WebContents;
using extensions::APIPermission;
+using extensions::RequestMediaAccessPermissionHelper;
namespace {
const int kDefaultWidth = 512;
@@ -193,31 +195,8 @@ void ShellWindow::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest* request,
const content::MediaResponseCallback& callback) {
- content::MediaStreamDevices devices;
-
- // Auto-accept the first audio device and the first video device from the
- // request when the appropriate API permissions exist.
- 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) &&
- extension()->HasAPIPermission(APIPermission::kAudioCapture) &&
- !it->second.empty()) {
- devices.push_back(it->second.front());
- accepted_an_audio_device = true;
- } else if (!accepted_a_video_device &&
- content::IsVideoMediaType(it->first) &&
- extension()->HasAPIPermission(APIPermission::kVideoCapture) &&
- !it->second.empty()) {
- devices.push_back(it->second.front());
- accepted_a_video_device = true;
- }
- }
-
- callback.Run(devices);
+ RequestMediaAccessPermissionHelper::AuthorizeRequest(
+ request, callback, extension(), true);
}
WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698