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