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 #include "content/browser/renderer_host/media/media_stream_manager.h" | 5 #include "content/browser/renderer_host/media/media_stream_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <cctype> | 10 #include <cctype> |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 media_observer->OnMediaRequestStateChanged( | 306 media_observer->OnMediaRequestStateChanged( |
307 target_process_id_, target_frame_id_, page_request_id, security_origin, | 307 target_process_id_, target_frame_id_, page_request_id, security_origin, |
308 stream_type, new_state); | 308 stream_type, new_state); |
309 } | 309 } |
310 | 310 |
311 MediaRequestState state(MediaStreamType stream_type) const { | 311 MediaRequestState state(MediaStreamType stream_type) const { |
312 return state_[stream_type]; | 312 return state_[stream_type]; |
313 } | 313 } |
314 | 314 |
| 315 void SetCapturingLinkSecured(bool is_secure) { |
| 316 MediaObserver* media_observer = |
| 317 GetContentClient()->browser()->GetMediaObserver(); |
| 318 if (!media_observer) |
| 319 return; |
| 320 |
| 321 media_observer->OnSetCapturingLinkSecured(target_process_id_, |
| 322 target_frame_id_, page_request_id, |
| 323 video_type_, is_secure); |
| 324 } |
| 325 |
315 MediaStreamRequester* const requester; // Can be NULL. | 326 MediaStreamRequester* const requester; // Can be NULL. |
316 | 327 |
317 | 328 |
318 // The render process id that requested this stream to be generated and that | 329 // The render process id that requested this stream to be generated and that |
319 // will receive a handle to the MediaStream. This may be different from | 330 // will receive a handle to the MediaStream. This may be different from |
320 // MediaStreamRequest::render_process_id which in the tab capture case | 331 // MediaStreamRequest::render_process_id which in the tab capture case |
321 // specifies the target renderer from which audio and video is captured. | 332 // specifies the target renderer from which audio and video is captured. |
322 const int requesting_process_id; | 333 const int requesting_process_id; |
323 | 334 |
324 // The render frame id that requested this stream to be generated and that | 335 // The render frame id that requested this stream to be generated and that |
(...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 const GURL& security_origin, | 2122 const GURL& security_origin, |
2112 const std::string& device_guid, | 2123 const std::string& device_guid, |
2113 const std::string& raw_unique_id) { | 2124 const std::string& raw_unique_id) { |
2114 DCHECK(security_origin.is_valid()); | 2125 DCHECK(security_origin.is_valid()); |
2115 DCHECK(!raw_unique_id.empty()); | 2126 DCHECK(!raw_unique_id.empty()); |
2116 std::string guid_from_raw_device_id = | 2127 std::string guid_from_raw_device_id = |
2117 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); | 2128 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); |
2118 return guid_from_raw_device_id == device_guid; | 2129 return guid_from_raw_device_id == device_guid; |
2119 } | 2130 } |
2120 | 2131 |
| 2132 void MediaStreamManager::SetCapturingLinkSecured( |
| 2133 int session_id, |
| 2134 const std::string& stream_device_id, |
| 2135 bool is_secure) { |
| 2136 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 2137 |
| 2138 for (LabeledDeviceRequest& labeled_request : requests_) { |
| 2139 DeviceRequest* request = labeled_request.second; |
| 2140 for (const StreamDeviceInfo& device_info : request->devices) { |
| 2141 if (device_info.session_id == session_id && |
| 2142 device_info.device.id == stream_device_id) { |
| 2143 DCHECK(device_info.device.type == content::MEDIA_TAB_VIDEO_CAPTURE || |
| 2144 device_info.device.type == content::MEDIA_DESKTOP_VIDEO_CAPTURE); |
| 2145 request->SetCapturingLinkSecured(is_secure); |
| 2146 } |
| 2147 } |
| 2148 } |
| 2149 } |
| 2150 |
2121 } // namespace content | 2151 } // namespace content |
OLD | NEW |