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); |