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

Unified Diff: chrome/browser/profiles/profile_io_data.cc

Issue 502483002: Check policy when checking device access for enumerating devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added dchecks Created 6 years, 4 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/profiles/profile_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index bddd0e861806d430d6ed65153a11ce49f6b1982a..68cb5ce9e0f4a305e1f5208ce8508478cb7f95f5 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/media/media_device_id_salt.h"
+#include "chrome/browser/media/media_stream_devices_helper.h"
#include "chrome/browser/net/about_protocol_handler.h"
#include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h"
#include "chrome/browser/net/chrome_http_user_agent_settings.h"
@@ -872,6 +873,7 @@ void ProfileIOData::set_http_server_properties(
ProfileIOData::ResourceContext::ResourceContext(ProfileIOData* io_data)
: io_data_(io_data),
+ profile_(NULL),
host_resolver_(NULL),
request_context_(NULL) {
DCHECK(io_data);
@@ -879,6 +881,12 @@ ProfileIOData::ResourceContext::ResourceContext(ProfileIOData* io_data)
ProfileIOData::ResourceContext::~ResourceContext() {}
+void ProfileIOData::ResourceContext::set_profile(Profile* profile) {
+ DCHECK(!profile_);
+ DCHECK(profile);
+ profile_ = profile;
+}
+
net::HostResolver* ProfileIOData::ResourceContext::GetHostResolver() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(io_data_->initialized_);
@@ -951,10 +959,20 @@ void ProfileIOData::ResourceContext::CreateKeygenHandler(
}
bool ProfileIOData::ResourceContext::AllowMicAccess(const GURL& origin) {
+ DCHECK(profile_);
+ if (GetDevicePolicy(profile_, origin, prefs::kAudioCaptureAllowed,
+ prefs::kAudioCaptureAllowedUrls) == ALWAYS_ALLOW) {
mmenke 2014/08/22 20:08:52 Erm...Aren't we on the IO thread here, not the UI
+ return true;
+ }
return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
}
bool ProfileIOData::ResourceContext::AllowCameraAccess(const GURL& origin) {
+ DCHECK(profile_);
+ if (GetDevicePolicy(profile_, origin, prefs::kVideoCaptureAllowed,
+ prefs::kVideoCaptureAllowedUrls) == ALWAYS_ALLOW) {
+ return true;
+ }
return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
}

Powered by Google App Engine
This is Rietveld 408576698