| Index: content/browser/renderer_host/media/media_devices_dispatcher_host.h
|
| diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host.h b/content/browser/renderer_host/media/media_devices_dispatcher_host.h
|
| index 9302e1304c31798dc0d2e4f05830ecd6e4e6b674..46d8b4cb9aadda610364a8750bec732fbce7a429 100644
|
| --- a/content/browser/renderer_host/media/media_devices_dispatcher_host.h
|
| +++ b/content/browser/renderer_host/media/media_devices_dispatcher_host.h
|
| @@ -7,6 +7,7 @@
|
|
|
| #include <memory>
|
| #include <string>
|
| +#include <vector>
|
|
|
| #include "base/macros.h"
|
| #include "content/browser/media/media_devices_permission_checker.h"
|
| @@ -25,16 +26,17 @@ namespace content {
|
| class MediaStreamManager;
|
|
|
| class CONTENT_EXPORT MediaDevicesDispatcherHost
|
| - : public ::mojom::MediaDevicesDispatcherHost {
|
| + : public ::mojom::MediaDevicesDispatcherHost,
|
| + public MediaDeviceChangeSubscriber {
|
| public:
|
| MediaDevicesDispatcherHost(int render_process_id,
|
| - int routing_id,
|
| + int render_frame_id,
|
| const std::string& device_id_salt,
|
| MediaStreamManager* media_stream_manager);
|
| ~MediaDevicesDispatcherHost() override;
|
|
|
| static void Create(int render_process_id,
|
| - int routing_id,
|
| + int render_frame_id,
|
| const std::string& device_id_salt,
|
| MediaStreamManager* media_stream_manager,
|
| ::mojom::MediaDevicesDispatcherHostRequest request);
|
| @@ -46,10 +48,23 @@ class CONTENT_EXPORT MediaDevicesDispatcherHost
|
| bool request_audio_output,
|
| const url::Origin& security_origin,
|
| const EnumerateDevicesCallback& client_callback) override;
|
| + void SubscribeDeviceChangeNotifications(
|
| + MediaDeviceType type,
|
| + uint32_t subscription_id,
|
| + const url::Origin& security_origin) override;
|
| + void UnsubscribeDeviceChangeNotifications(MediaDeviceType type,
|
| + uint32_t subscription_id) override;
|
| +
|
| + // MediaDeviceChangeSubscriber implementation.
|
| + void OnDevicesChanged(MediaDeviceType type,
|
| + const MediaDeviceInfoArray& device_infos) override;
|
|
|
| void SetPermissionChecker(
|
| const MediaDevicesPermissionChecker& permission_checker);
|
|
|
| + void SetDeviceChangeListenerForTesting(
|
| + ::mojom::MediaDevicesListenerPtr listener);
|
| +
|
| private:
|
| void DoEnumerateDevices(
|
| const MediaDevicesManager::BoolDeviceTypes& requested_types,
|
| @@ -64,12 +79,26 @@ class CONTENT_EXPORT MediaDevicesDispatcherHost
|
| const MediaDevicesManager::BoolDeviceTypes& has_permissions,
|
| const MediaDeviceEnumeration& enumeration);
|
|
|
| - int render_process_id_;
|
| - int routing_id_;
|
| - std::string device_id_salt_;
|
| - std::string group_id_salt_;
|
| + struct SubscriptionInfo;
|
| + void NotifyDeviceChangeOnUIThread(
|
| + const std::vector<SubscriptionInfo>& subscriptions,
|
| + MediaDeviceType type,
|
| + const MediaDeviceInfoArray& device_infos);
|
| +
|
| + // The following const fields can be accessed on any thread.
|
| + const int render_process_id_;
|
| + const int render_frame_id_;
|
| + const std::string device_id_salt_;
|
| + const std::string group_id_salt_;
|
| +
|
| + // The following fields can only be accessed on the IO thread.
|
| MediaStreamManager* media_stream_manager_;
|
| MediaDevicesPermissionChecker permission_checker_;
|
| + std::vector<SubscriptionInfo>
|
| + device_change_subscriptions_[NUM_MEDIA_DEVICE_TYPES];
|
| +
|
| + // This field can only be accessed on the UI thread.
|
| + ::mojom::MediaDevicesListenerPtr device_change_listener_;
|
|
|
| base::WeakPtrFactory<MediaDevicesDispatcherHost> weak_factory_;
|
|
|
|
|