Chromium Code Reviews| 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 "media/capture/mojo/video_capture_types.mojom"; | |
| 7 import "url/mojo/origin.mojom"; | 8 import "url/mojo/origin.mojom"; |
| 8 | 9 |
| 9 [Native] | 10 [Native] |
| 10 enum MediaDeviceType; | 11 enum MediaDeviceType; |
| 11 | 12 |
| 12 [Native] | 13 [Native] |
| 13 struct MediaDeviceInfo; | 14 struct MediaDeviceInfo; |
| 14 | 15 |
| 16 // The values for this enum match the ones defined in | |
| 17 // https://w3c.github.io/mediacapture-main/#def-constraint-facingMode | |
| 18 // with the addition of UNKNOWN, which would map to the empty string in | |
| 19 // JavaScript. | |
| 20 enum FacingMode { | |
| 21 USER, | |
| 22 ENVIRONMENT, | |
| 23 LEFT, | |
| 24 RIGHT, | |
| 25 UNKNOWN | |
|
hta - Chromium
2017/01/27 10:40:47
Is there a particular reason for not calling it NO
Guido Urdaneta
2017/01/27 14:10:47
Changed to NONE. Wasn't aware of the pattern.
| |
| 26 }; | |
| 27 | |
| 28 struct VideoInputDeviceCapabilities { | |
| 29 string device_id; | |
| 30 array<media.mojom.VideoCaptureFormat> formats; | |
| 31 FacingMode facing_mode; | |
| 32 }; | |
| 33 | |
| 15 // This object lives in the browser and is responsible for processing device | 34 // This object lives in the browser and is responsible for processing device |
| 16 // enumeration requests and managing subscriptions for device-change | 35 // enumeration requests and managing subscriptions for device-change |
| 17 // notifications. | 36 // notifications. |
| 18 interface MediaDevicesDispatcherHost { | 37 interface MediaDevicesDispatcherHost { |
| 19 // The reply always contains NUM_MEDIA_DEVICE_TYPES elements. | 38 // The reply always contains NUM_MEDIA_DEVICE_TYPES elements. |
| 20 // The result is indexed by device type as defined in | 39 // The result is indexed by device type as defined in |
| 21 // content/common/media/media_devices.h. | 40 // content/common/media/media_devices.h. |
| 22 EnumerateDevices(bool request_audio_input, | 41 EnumerateDevices(bool request_audio_input, |
| 23 bool request_video_input, | 42 bool request_video_input, |
| 24 bool request_audio_output, | 43 bool request_audio_output, |
| 25 url.mojom.Origin security_origin) | 44 url.mojom.Origin security_origin) |
| 26 => (array<array<MediaDeviceInfo>> enumeration); | 45 => (array<array<MediaDeviceInfo>> enumeration); |
| 46 | |
| 47 // Returns a list of video devices and their capabilities. | |
| 48 // If there is a user-preferred device, it is the first in the result. | |
| 49 // The result of this function is intended for the implementation details | |
| 50 // of algorithms such as settings selection for getUserMedia. | |
| 51 // Do not expose the data contained in result of this function to JavaScript. | |
| 52 GetVideoInputCapabilities(url.mojom.Origin security_origin) | |
| 53 => (array<VideoInputDeviceCapabilities> video_input_device_capabilities); | |
| 27 | 54 |
| 28 // Creates a subscription for device-change notifications for the calling | 55 // Creates a subscription for device-change notifications for the calling |
| 29 // frame/security origin. It is the responsibility of the caller to send | 56 // frame/security origin. It is the responsibility of the caller to send |
| 30 // |subscription_id| values that are unique per device type. | 57 // |subscription_id| values that are unique per device type. |
| 31 // Requests to create a subscription with an ID that already exists for type | 58 // Requests to create a subscription with an ID that already exists for type |
| 32 // |type| are invalid and result in a renderer crash. | 59 // |type| are invalid and result in a renderer crash. |
| 33 SubscribeDeviceChangeNotifications(MediaDeviceType type, | 60 SubscribeDeviceChangeNotifications(MediaDeviceType type, |
| 34 uint32 subscription_id, | 61 uint32 subscription_id, |
| 35 url.mojom.Origin security_origin); | 62 url.mojom.Origin security_origin); |
| 36 | 63 |
| 37 // Removes a subscription to device-change notifications for the calling | 64 // Removes a subscription to device-change notifications for the calling |
| 38 // frame. The caller is responsible for sending |subscription_id| values that | 65 // frame. The caller is responsible for sending |subscription_id| values that |
| 39 // that refer to existing subscriptions for type |type|. Requests to remove | 66 // that refer to existing subscriptions for type |type|. Requests to remove |
| 40 // a nonexisting subscription with are invalid and result in a renderer crash. | 67 // a nonexisting subscription with are invalid and result in a renderer crash. |
| 41 UnsubscribeDeviceChangeNotifications(MediaDeviceType type, | 68 UnsubscribeDeviceChangeNotifications(MediaDeviceType type, |
| 42 uint32 subscription_id); | 69 uint32 subscription_id); |
| 43 }; | 70 }; |
| 44 | 71 |
| 45 // This object lives in the renderer process and is used by the browser process | 72 // This object lives in the renderer process and is used by the browser process |
| 46 // to pass device-change notifications to the renderer. | 73 // to pass device-change notifications to the renderer. |
| 47 interface MediaDevicesListener { | 74 interface MediaDevicesListener { |
| 48 // Called to notify a change in the set of devices of type |type| for | 75 // 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 | 76 // subscription |subscription_id|. |device_infos| contains the new list of |
| 50 // devices of type |type|, with device and group IDs obfuscated according to | 77 // devices of type |type|, with device and group IDs obfuscated according to |
| 51 // the subscription's security origin. | 78 // the subscription's security origin. |
| 52 OnDevicesChanged(MediaDeviceType type, | 79 OnDevicesChanged(MediaDeviceType type, |
| 53 uint32 subscription_id, | 80 uint32 subscription_id, |
| 54 array<MediaDeviceInfo> device_infos); | 81 array<MediaDeviceInfo> device_infos); |
| 55 }; | 82 }; |
| OLD | NEW |