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

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

Issue 2490653002: Make Pepper use Mojo-based support for media-device enumeration and monitoring. (Closed)
Patch Set: address bbudge's comments Created 4 years, 1 month 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 | « no previous file | content/renderer/pepper/pepper_device_enumeration_host_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_device_enumeration_host_helper.h
diff --git a/content/renderer/pepper/pepper_device_enumeration_host_helper.h b/content/renderer/pepper/pepper_device_enumeration_host_helper.h
index 84ad18bbaccf65ede23b26fa2b990129a9dbf64f..70d5d66d9f37a5c60d805c766d19d5386d3661a6 100644
--- a/content/renderer/pepper/pepper_device_enumeration_host_helper.h
+++ b/content/renderer/pepper/pepper_device_enumeration_host_helper.h
@@ -44,19 +44,27 @@ class CONTENT_EXPORT PepperDeviceEnumerationHostHelper {
public:
virtual ~Delegate() {}
- typedef base::Callback<
- void(int /* request_id */,
- const std::vector<ppapi::DeviceRefData>& /* devices */)>
- EnumerateDevicesCallback;
-
- // Enumerates devices of the specified type. The request ID passed into the
- // callback will be the same as the return value.
- virtual int EnumerateDevices(PP_DeviceType_Dev type,
- const GURL& document_url,
- const EnumerateDevicesCallback& callback) = 0;
- // Stop enumerating devices of the specified |request_id|. The |request_id|
- // is the return value of EnumerateDevicesCallback.
- virtual void StopEnumerateDevices(int request_id) = 0;
+ using DevicesCallback = base::Callback<void(
+ const std::vector<ppapi::DeviceRefData>& /* devices */)>;
+
+ // Enumerates devices of the specified type.
+ virtual void EnumerateDevices(PP_DeviceType_Dev type,
+ const GURL& document_url,
+ const DevicesCallback& callback) = 0;
+
+ // Starts monitoring devices of the specified |type|. Returns a
+ // subscription ID that must be used to stop monitoring for the device
+ // |type|. Does not invoke |callback| synchronously. |callback| is invoked
+ // when device changes of the specified |type| occur.
+ virtual uint32_t StartMonitoringDevices(
+ PP_DeviceType_Dev type,
+ const GURL& document_url,
+ const DevicesCallback& callback) = 0;
+
+ // Stops monitoring devices of the specified |type|. The
+ // |subscription_id| is the return value of StartMonitoringDevices.
+ virtual void StopMonitoringDevices(PP_DeviceType_Dev type,
+ uint32_t subscription_id) = 0;
};
// |resource_host| and |delegate| must outlive this object.
@@ -72,7 +80,8 @@ class CONTENT_EXPORT PepperDeviceEnumerationHostHelper {
int32_t* result);
private:
- class ScopedRequest;
+ class ScopedEnumerationRequest;
+ class ScopedMonitoringRequest;
// Has a different signature than HandleResourceMessage() in order to utilize
// message dispatching macros.
@@ -88,10 +97,8 @@ class CONTENT_EXPORT PepperDeviceEnumerationHostHelper {
ppapi::host::HostMessageContext* context);
void OnEnumerateDevicesComplete(
- int request_id,
const std::vector<ppapi::DeviceRefData>& devices);
void OnNotifyDeviceChange(uint32_t callback_id,
- int request_id,
const std::vector<ppapi::DeviceRefData>& devices);
// Non-owning pointers.
@@ -101,8 +108,8 @@ class CONTENT_EXPORT PepperDeviceEnumerationHostHelper {
PP_DeviceType_Dev device_type_;
GURL document_url_;
- std::unique_ptr<ScopedRequest> enumerate_;
- std::unique_ptr<ScopedRequest> monitor_;
+ std::unique_ptr<ScopedEnumerationRequest> enumerate_;
+ std::unique_ptr<ScopedMonitoringRequest> monitor_;
ppapi::host::ReplyMessageContext enumerate_devices_context_;
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_device_enumeration_host_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698