| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void OnAudioCaptureDevicesChanged() override; | 130 void OnAudioCaptureDevicesChanged() override; |
| 131 void OnVideoCaptureDevicesChanged() override; | 131 void OnVideoCaptureDevicesChanged() override; |
| 132 void OnMediaRequestStateChanged(int render_process_id, | 132 void OnMediaRequestStateChanged(int render_process_id, |
| 133 int render_frame_id, | 133 int render_frame_id, |
| 134 int page_request_id, | 134 int page_request_id, |
| 135 const GURL& security_origin, | 135 const GURL& security_origin, |
| 136 content::MediaStreamType stream_type, | 136 content::MediaStreamType stream_type, |
| 137 content::MediaRequestState state) override; | 137 content::MediaRequestState state) override; |
| 138 void OnCreatingAudioStream(int render_process_id, | 138 void OnCreatingAudioStream(int render_process_id, |
| 139 int render_frame_id) override; | 139 int render_frame_id) override; |
| 140 void OnSetCapturingLinkSecured(int render_process_id, |
| 141 int render_frame_id, |
| 142 int page_request_id, |
| 143 content::MediaStreamType stream_type, |
| 144 bool is_secure) override; |
| 140 | 145 |
| 141 scoped_refptr<MediaStreamCaptureIndicator> GetMediaStreamCaptureIndicator(); | 146 scoped_refptr<MediaStreamCaptureIndicator> GetMediaStreamCaptureIndicator(); |
| 142 | 147 |
| 143 DesktopStreamsRegistry* GetDesktopStreamsRegistry(); | 148 DesktopStreamsRegistry* GetDesktopStreamsRegistry(); |
| 144 | 149 |
| 145 bool IsDesktopCaptureInProgress(); | 150 // Return true if there is any ongoing insecured capturing. The capturing is |
| 151 // deemed secure if all connected video sinks are reported secure and the |
| 152 // extension is trusted. |
| 153 bool IsInsecureCapturingInProgress(int render_process_id, |
| 154 int render_frame_id); |
| 146 | 155 |
| 147 // Only for testing. | 156 // Only for testing. |
| 148 void SetTestAudioCaptureDevices(const content::MediaStreamDevices& devices); | 157 void SetTestAudioCaptureDevices(const content::MediaStreamDevices& devices); |
| 149 void SetTestVideoCaptureDevices(const content::MediaStreamDevices& devices); | 158 void SetTestVideoCaptureDevices(const content::MediaStreamDevices& devices); |
| 150 | 159 |
| 151 private: | 160 private: |
| 152 friend struct base::DefaultSingletonTraits<MediaCaptureDevicesDispatcher>; | 161 friend struct base::DefaultSingletonTraits<MediaCaptureDevicesDispatcher>; |
| 153 | 162 |
| 154 MediaCaptureDevicesDispatcher(); | 163 MediaCaptureDevicesDispatcher(); |
| 155 ~MediaCaptureDevicesDispatcher() override; | 164 ~MediaCaptureDevicesDispatcher() override; |
| 156 | 165 |
| 157 // Called by the MediaObserver() functions, executed on UI thread. | 166 // Called by the MediaObserver() functions, executed on UI thread. |
| 158 void NotifyAudioDevicesChangedOnUIThread(); | 167 void NotifyAudioDevicesChangedOnUIThread(); |
| 159 void NotifyVideoDevicesChangedOnUIThread(); | 168 void NotifyVideoDevicesChangedOnUIThread(); |
| 160 void UpdateMediaRequestStateOnUIThread( | 169 void UpdateMediaRequestStateOnUIThread( |
| 161 int render_process_id, | 170 int render_process_id, |
| 162 int render_frame_id, | 171 int render_frame_id, |
| 163 int page_request_id, | 172 int page_request_id, |
| 164 const GURL& security_origin, | 173 const GURL& security_origin, |
| 165 content::MediaStreamType stream_type, | 174 content::MediaStreamType stream_type, |
| 166 content::MediaRequestState state); | 175 content::MediaRequestState state); |
| 167 void OnCreatingAudioStreamOnUIThread(int render_process_id, | 176 void OnCreatingAudioStreamOnUIThread(int render_process_id, |
| 168 int render_frame_id); | 177 int render_frame_id); |
| 178 void UpdateCapturingLinkSecured(int render_process_id, |
| 179 int render_frame_id, |
| 180 int page_request_id, |
| 181 content::MediaStreamType stream_type, |
| 182 bool is_secure); |
| 169 | 183 |
| 170 // Only for testing, a list of cached audio capture devices. | 184 // Only for testing, a list of cached audio capture devices. |
| 171 content::MediaStreamDevices test_audio_devices_; | 185 content::MediaStreamDevices test_audio_devices_; |
| 172 | 186 |
| 173 // Only for testing, a list of cached video capture devices. | 187 // Only for testing, a list of cached video capture devices. |
| 174 content::MediaStreamDevices test_video_devices_; | 188 content::MediaStreamDevices test_video_devices_; |
| 175 | 189 |
| 176 // A list of observers for the device update notifications. | 190 // A list of observers for the device update notifications. |
| 177 base::ObserverList<Observer> observers_; | 191 base::ObserverList<Observer> observers_; |
| 178 | 192 |
| 179 // Flag used by unittests to disable device enumeration. | 193 // Flag used by unittests to disable device enumeration. |
| 180 bool is_device_enumeration_disabled_; | 194 bool is_device_enumeration_disabled_; |
| 181 | 195 |
| 182 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 196 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; |
| 183 | 197 |
| 184 std::unique_ptr<DesktopStreamsRegistry> desktop_streams_registry_; | 198 std::unique_ptr<DesktopStreamsRegistry> desktop_streams_registry_; |
| 185 | 199 |
| 186 // Handlers for processing media access requests. | 200 // Handlers for processing media access requests. |
| 187 ScopedVector<MediaAccessHandler> media_access_handlers_; | 201 ScopedVector<MediaAccessHandler> media_access_handlers_; |
| 188 | 202 |
| 189 DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesDispatcher); | 203 DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesDispatcher); |
| 190 }; | 204 }; |
| 191 | 205 |
| 192 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 206 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
| OLD | NEW |