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

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

Issue 929253004: Do not always store media device rejection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed SetPermission to StorePersmission. Created 5 years, 10 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/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 dc0d0e8bbe436cf42364330c36b6636e2e8513b0..3156b78c5f95e1ea40f8f7474d2ca86bc4bff62e 100644
--- a/chrome/browser/media/media_stream_devices_controller.cc
+++ b/chrome/browser/media/media_stream_devices_controller.cc
@@ -385,7 +385,7 @@ void MediaStreamDevicesController::Accept(bool update_content_setting) {
if (update_content_setting) {
if ((IsSchemeSecure() && !devices.empty()) ||
request_.request_type == content::MEDIA_OPEN_DEVICE) {
- SetPermission(true);
+ StorePersmission(true);
}
}
@@ -423,9 +423,11 @@ void MediaStreamDevicesController::Deny(
DLOG(WARNING) << "MediaStreamDevicesController::Deny: " << result;
NotifyUIRequestDenied();
- if (update_content_setting) {
+ if (update_content_setting && request_.all_ancestors_have_same_origin) {
+ // Store sticky permissions if |update_content_setting| and the request
+ // is not done from an iframe where the ancestor has a different origin.
CHECK_EQ(content::MEDIA_DEVICE_PERMISSION_DENIED, result);
- SetPermission(false);
+ StorePersmission(false);
}
content::MediaResponseCallback cb = callback_;
@@ -604,7 +606,7 @@ bool MediaStreamDevicesController::IsSchemeSecure() const {
request_.security_origin.SchemeIs(extensions::kExtensionScheme);
}
-void MediaStreamDevicesController::SetPermission(bool allowed) const {
+void MediaStreamDevicesController::StorePersmission(bool allowed) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ContentSettingsPattern primary_pattern =
ContentSettingsPattern::FromURLNoWildcard(request_.security_origin);

Powered by Google App Engine
This is Rietveld 408576698