Index: content/common/media/media_devices.mojom |
diff --git a/content/common/media/media_devices.mojom b/content/common/media/media_devices.mojom |
index 97d11854a1a453fc3ac22bef39f9905f93606802..d53232e580266f2337d724cee50c8786666f33b9 100644 |
--- a/content/common/media/media_devices.mojom |
+++ b/content/common/media/media_devices.mojom |
@@ -13,8 +13,8 @@ enum MediaDeviceType; |
struct MediaDeviceInfo; |
// This object lives in the browser and is responsible for processing device |
-// enumeration requests. |
-// TODO(guidou): Add support for device-change notifications. |
+// enumeration requests and managing subscriptions for device-change |
+// notifications. |
interface MediaDevicesDispatcherHost { |
// The reply always contains NUM_MEDIA_DEVICE_TYPES elements. |
// The result is indexed by device type as defined in |
@@ -24,4 +24,32 @@ interface MediaDevicesDispatcherHost { |
bool request_audio_output, |
url.mojom.Origin security_origin) |
=> (array<array<MediaDeviceInfo>> enumeration); |
+ |
+ // Creates a subscription for device-change notifications for the calling |
+ // frame/security origin. It is the responsibility of the caller to send |
+ // |subscription_id| values that are unique per device type. |
+ // Requests to create a subscription with an ID that already exists for type |
+ // |type| are invalid and result in a renderer crash. |
+ SubscribeDeviceChangeNotifications(MediaDeviceType type, |
+ uint32 subscription_id, |
+ url.mojom.Origin security_origin); |
+ |
+ // Removes a subscription to device-change notifications for the calling |
+ // frame. The caller is responsible for sending |subscription_id| values that |
+ // that refer to existing subscriptions for type |type|. Requests to remove |
+ // a nonexisting subscription with are invalid and result in a renderer crash. |
+ UnsubscribeDeviceChangeNotifications(MediaDeviceType type, |
+ uint32 subscription_id); |
+}; |
+ |
+// This object lives in the renderer process and is used by the browser process |
+// to pass device-change notifications to the renderer. |
+interface MediaDevicesListener { |
+ // Called to notify a change in the set of devices of type |type| for |
+ // subscription |subscription_id|. |device_infos| contains the new list of |
+ // devices of type |type|, with device and group IDs obfuscated according to |
+ // the subscription's security origin. |
+ OnDevicesChanged(MediaDeviceType type, |
+ uint32 subscription_id, |
+ array<MediaDeviceInfo> device_infos); |
}; |