| OLD | NEW | 
|   1 // Copyright 2016 The Chromium Authors. All rights reserved. |   1 // Copyright 2016 The Chromium Authors. All rights reserved. | 
|   2 // Use of this source code is governed by a BSD-style license that can be |   2 // Use of this source code is governed by a BSD-style license that can be | 
|   3 // found in the LICENSE file. |   3 // found in the LICENSE file. | 
|   4  |   4  | 
|   5 module mojom; |   5 module mojom; | 
|   6  |   6  | 
|   7 import "url/mojo/origin.mojom"; |   7 import "url/mojo/origin.mojom"; | 
|   8  |   8  | 
|   9 [Native] |   9 [Native] | 
|  10 enum MediaDeviceType; |  10 enum MediaDeviceType; | 
|  11  |  11  | 
|  12 [Native] |  12 [Native] | 
|  13 struct MediaDeviceInfo; |  13 struct MediaDeviceInfo; | 
|  14  |  14  | 
|  15 // This object lives in the browser and is responsible for processing device |  15 // This object lives in the browser and is responsible for processing device | 
|  16 // enumeration requests. |  16 // enumeration requests and managing subscriptions for device-change | 
|  17 // TODO(guidou): Add support for device-change notifications. |  17 // notifications. | 
|  18 interface MediaDevicesDispatcherHost { |  18 interface MediaDevicesDispatcherHost { | 
|  19   // The reply always contains NUM_MEDIA_DEVICE_TYPES elements. |  19   // The reply always contains NUM_MEDIA_DEVICE_TYPES elements. | 
|  20   // The result is indexed by device type as defined in  |  20   // The result is indexed by device type as defined in  | 
|  21   // content/common/media/media_devices.h. |  21   // content/common/media/media_devices.h. | 
|  22   EnumerateDevices(bool request_audio_input, |  22   EnumerateDevices(bool request_audio_input, | 
|  23                    bool request_video_input, |  23                    bool request_video_input, | 
|  24                    bool request_audio_output, |  24                    bool request_audio_output, | 
|  25                    url.mojom.Origin security_origin) |  25                    url.mojom.Origin security_origin) | 
|  26                        => (array<array<MediaDeviceInfo>> enumeration); |  26                        => (array<array<MediaDeviceInfo>> enumeration); | 
 |  27  | 
 |  28   // Creates a subscription for device-change notifications for the calling | 
 |  29   // frame/security origin. It is the responsibility of the caller to send | 
 |  30   // |subscription_id| values that are unique per device type. | 
 |  31   // Requests to create a subscription with an ID that already exists for type | 
 |  32   // |type| are invalid and result in a renderer crash. | 
 |  33   SubscribeDeviceChangeNotifications(MediaDeviceType type, | 
 |  34                                      uint32 subscription_id, | 
 |  35                                      url.mojom.Origin security_origin); | 
 |  36  | 
 |  37   // Removes a subscription to device-change notifications for the calling | 
 |  38   // frame. The caller is responsible for sending |subscription_id| values that | 
 |  39   // that refer to existing subscriptions for type |type|. Requests to remove | 
 |  40   // a nonexisting subscription with are invalid and result in a renderer crash. | 
 |  41   UnsubscribeDeviceChangeNotifications(MediaDeviceType type, | 
 |  42                                        uint32 subscription_id); | 
|  27 }; |  43 }; | 
 |  44  | 
 |  45 // This object lives in the renderer process and is used by the browser process | 
 |  46 // to pass device-change notifications to the renderer. | 
 |  47 interface MediaDevicesListener { | 
 |  48   // Called to notify a change in the set of devices of type |type| for | 
 |  49   // subscription |subscription_id|. |device_infos| contains the new list of | 
 |  50   // devices of type |type|, with device and group IDs obfuscated according to | 
 |  51   // the subscription's security origin. | 
 |  52   OnDevicesChanged(MediaDeviceType type, | 
 |  53                    uint32 subscription_id, | 
 |  54                    array<MediaDeviceInfo> device_infos); | 
 |  55 }; | 
| OLD | NEW |