| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "content/browser/media/media_devices_permission_checker.h" | 13 #include "content/browser/media/media_devices_permission_checker.h" |
| 14 #include "content/browser/renderer_host/media/media_devices_manager.h" | 14 #include "content/browser/renderer_host/media/media_devices_manager.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "content/common/media/media_devices.mojom.h" | 16 #include "content/common/media/media_devices.mojom.h" |
| 17 #include "media/capture/video/video_capture_device_descriptor.h" |
| 17 | 18 |
| 18 using ::mojom::MediaDeviceType; | 19 using ::mojom::MediaDeviceType; |
| 19 | 20 |
| 20 namespace url { | 21 namespace url { |
| 21 class Origin; | 22 class Origin; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 | 26 |
| 26 class MediaStreamManager; | 27 class MediaStreamManager; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 MediaStreamManager* media_stream_manager, | 42 MediaStreamManager* media_stream_manager, |
| 42 ::mojom::MediaDevicesDispatcherHostRequest request); | 43 ::mojom::MediaDevicesDispatcherHostRequest request); |
| 43 | 44 |
| 44 // ::mojom::MediaDevicesDispatcherHost implementation. | 45 // ::mojom::MediaDevicesDispatcherHost implementation. |
| 45 void EnumerateDevices( | 46 void EnumerateDevices( |
| 46 bool request_audio_input, | 47 bool request_audio_input, |
| 47 bool request_video_input, | 48 bool request_video_input, |
| 48 bool request_audio_output, | 49 bool request_audio_output, |
| 49 const url::Origin& security_origin, | 50 const url::Origin& security_origin, |
| 50 const EnumerateDevicesCallback& client_callback) override; | 51 const EnumerateDevicesCallback& client_callback) override; |
| 52 void GetVideoInputCapabilities( |
| 53 const url::Origin& security_origin, |
| 54 const GetVideoInputCapabilitiesCallback& client_callback) override; |
| 51 void SubscribeDeviceChangeNotifications( | 55 void SubscribeDeviceChangeNotifications( |
| 52 MediaDeviceType type, | 56 MediaDeviceType type, |
| 53 uint32_t subscription_id, | 57 uint32_t subscription_id, |
| 54 const url::Origin& security_origin) override; | 58 const url::Origin& security_origin) override; |
| 55 void UnsubscribeDeviceChangeNotifications(MediaDeviceType type, | 59 void UnsubscribeDeviceChangeNotifications(MediaDeviceType type, |
| 56 uint32_t subscription_id) override; | 60 uint32_t subscription_id) override; |
| 57 | 61 |
| 58 // MediaDeviceChangeSubscriber implementation. | 62 // MediaDeviceChangeSubscriber implementation. |
| 59 void OnDevicesChanged(MediaDeviceType type, | 63 void OnDevicesChanged(MediaDeviceType type, |
| 60 const MediaDeviceInfoArray& device_infos) override; | 64 const MediaDeviceInfoArray& device_infos) override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 72 const EnumerateDevicesCallback& client_callback, | 76 const EnumerateDevicesCallback& client_callback, |
| 73 const MediaDevicesManager::BoolDeviceTypes& permissions); | 77 const MediaDevicesManager::BoolDeviceTypes& permissions); |
| 74 | 78 |
| 75 void DevicesEnumerated( | 79 void DevicesEnumerated( |
| 76 const MediaDevicesManager::BoolDeviceTypes& requested_types, | 80 const MediaDevicesManager::BoolDeviceTypes& requested_types, |
| 77 const url::Origin& security_origin, | 81 const url::Origin& security_origin, |
| 78 const EnumerateDevicesCallback& client_callback, | 82 const EnumerateDevicesCallback& client_callback, |
| 79 const MediaDevicesManager::BoolDeviceTypes& has_permissions, | 83 const MediaDevicesManager::BoolDeviceTypes& has_permissions, |
| 80 const MediaDeviceEnumeration& enumeration); | 84 const MediaDeviceEnumeration& enumeration); |
| 81 | 85 |
| 86 void GotDefaultVideoInputDeviceID( |
| 87 const url::Origin& security_origin, |
| 88 const GetVideoInputCapabilitiesCallback& client_callback, |
| 89 const std::string& default_device_id); |
| 90 |
| 91 void FinalizeGetVideoInputCapabilities( |
| 92 const url::Origin& security_origin, |
| 93 const GetVideoInputCapabilitiesCallback& client_callback, |
| 94 const std::string& default_device_id, |
| 95 const media::VideoCaptureDeviceDescriptors& device_descriptors); |
| 96 |
| 97 // Returns the currently supported video formats for the given |device_id|. |
| 98 media::VideoCaptureFormats GetVideoInputFormats(const std::string& device_id); |
| 99 |
| 82 struct SubscriptionInfo; | 100 struct SubscriptionInfo; |
| 83 void NotifyDeviceChangeOnUIThread( | 101 void NotifyDeviceChangeOnUIThread( |
| 84 const std::vector<SubscriptionInfo>& subscriptions, | 102 const std::vector<SubscriptionInfo>& subscriptions, |
| 85 MediaDeviceType type, | 103 MediaDeviceType type, |
| 86 const MediaDeviceInfoArray& device_infos); | 104 const MediaDeviceInfoArray& device_infos); |
| 87 | 105 |
| 88 // The following const fields can be accessed on any thread. | 106 // The following const fields can be accessed on any thread. |
| 89 const int render_process_id_; | 107 const int render_process_id_; |
| 90 const int render_frame_id_; | 108 const int render_frame_id_; |
| 91 const std::string device_id_salt_; | 109 const std::string device_id_salt_; |
| 92 const std::string group_id_salt_; | 110 const std::string group_id_salt_; |
| 93 | 111 |
| 94 // The following fields can only be accessed on the IO thread. | 112 // The following fields can only be accessed on the IO thread. |
| 95 MediaStreamManager* media_stream_manager_; | 113 MediaStreamManager* media_stream_manager_; |
| 96 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_; | 114 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_; |
| 97 std::vector<SubscriptionInfo> | 115 std::vector<SubscriptionInfo> |
| 98 device_change_subscriptions_[NUM_MEDIA_DEVICE_TYPES]; | 116 device_change_subscriptions_[NUM_MEDIA_DEVICE_TYPES]; |
| 99 | 117 |
| 100 // This field can only be accessed on the UI thread. | 118 // This field can only be accessed on the UI thread. |
| 101 ::mojom::MediaDevicesListenerPtr device_change_listener_; | 119 ::mojom::MediaDevicesListenerPtr device_change_listener_; |
| 102 | 120 |
| 103 base::WeakPtrFactory<MediaDevicesDispatcherHost> weak_factory_; | 121 base::WeakPtrFactory<MediaDevicesDispatcherHost> weak_factory_; |
| 104 | 122 |
| 105 DISALLOW_COPY_AND_ASSIGN(MediaDevicesDispatcherHost); | 123 DISALLOW_COPY_AND_ASSIGN(MediaDevicesDispatcherHost); |
| 106 }; | 124 }; |
| 107 | 125 |
| 108 } // namespace content | 126 } // namespace content |
| 109 | 127 |
| 110 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ | 128 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ |
| OLD | NEW |