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

Unified Diff: content/renderer/pepper/pepper_device_enumeration_host_helper.cc

Issue 2872913003: Do not pass the origin to MediaDevicesDispatcherHost. (Closed)
Patch Set: Add tests with unique origin Created 3 years, 7 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: content/renderer/pepper/pepper_device_enumeration_host_helper.cc
diff --git a/content/renderer/pepper/pepper_device_enumeration_host_helper.cc b/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
index dc4967c11216fcc587aac13517b450cbadd3f28c..ca12440c87003710185ff66053f2bf6e7f0cdd44 100644
--- a/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
+++ b/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
@@ -32,11 +32,14 @@ class PepperDeviceEnumerationHostHelper::ScopedEnumerationRequest
ScopedEnumerationRequest(PepperDeviceEnumerationHostHelper* owner,
const Delegate::DevicesCallback& callback)
: callback_(callback), requested_(false), sync_call_(false) {
- if (!owner->document_url_.is_valid())
- return;
-
- if (!owner->delegate_)
+ if (!owner->delegate_) {
+ // If no delegate, return an empty list of devices.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(&ScopedEnumerationRequest::EnumerateDevicesCallbackBody,
+ AsWeakPtr(), std::vector<ppapi::DeviceRefData>()));
return;
+ }
requested_ = true;
@@ -48,7 +51,7 @@ class PepperDeviceEnumerationHostHelper::ScopedEnumerationRequest
// asynchronously.
sync_call_ = true;
owner->delegate_->EnumerateDevices(
- owner->device_type_, owner->document_url_,
+ owner->device_type_,
base::Bind(&ScopedEnumerationRequest::EnumerateDevicesCallbackBody,
AsWeakPtr()));
sync_call_ = false;
@@ -90,18 +93,16 @@ class PepperDeviceEnumerationHostHelper::ScopedMonitoringRequest
requested_(false),
subscription_id_(0) {
DCHECK(owner_);
- if (!owner_->document_url_.is_valid())
- return;
-
- if (!owner->delegate_)
+ if (!owner->delegate_) {
return;
+ }
requested_ = true;
// |callback| is never called synchronously by StartMonitoringDevices(),
// so it is OK to pass it directly, even if |callback| destroys |this|.
subscription_id_ = owner_->delegate_->StartMonitoringDevices(
- owner_->device_type_, owner_->document_url_, callback);
+ owner_->device_type_, callback);
}
~ScopedMonitoringRequest() {
@@ -129,8 +130,7 @@ PepperDeviceEnumerationHostHelper::PepperDeviceEnumerationHostHelper(
const GURL& document_url)
: resource_host_(resource_host),
delegate_(delegate),
- device_type_(device_type),
- document_url_(document_url) {}
+ device_type_(device_type) {}
PepperDeviceEnumerationHostHelper::~PepperDeviceEnumerationHostHelper() {}

Powered by Google App Engine
This is Rietveld 408576698