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 <algorithm> | 10 #include <algorithm> |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 media_observer->OnMediaRequestStateChanged( | 303 media_observer->OnMediaRequestStateChanged( |
304 target_process_id_, target_frame_id_, page_request_id, | 304 target_process_id_, target_frame_id_, page_request_id, |
305 ConvertToGURL(security_origin), stream_type, new_state); | 305 ConvertToGURL(security_origin), stream_type, new_state); |
306 } | 306 } |
307 | 307 |
308 MediaRequestState state(MediaStreamType stream_type) const { | 308 MediaRequestState state(MediaStreamType stream_type) const { |
309 return state_[stream_type]; | 309 return state_[stream_type]; |
310 } | 310 } |
311 | 311 |
| 312 void SetCapturingLinkSecured(bool is_secure) { |
| 313 MediaObserver* media_observer = |
| 314 GetContentClient()->browser()->GetMediaObserver(); |
| 315 if (!media_observer) |
| 316 return; |
| 317 |
| 318 media_observer->OnSetCapturingLinkSecured(target_process_id_, |
| 319 target_frame_id_, page_request_id, |
| 320 video_type_, is_secure); |
| 321 } |
| 322 |
312 MediaStreamRequester* const requester; // Can be NULL. | 323 MediaStreamRequester* const requester; // Can be NULL. |
313 | 324 |
314 | 325 |
315 // The render process id that requested this stream to be generated and that | 326 // The render process id that requested this stream to be generated and that |
316 // will receive a handle to the MediaStream. This may be different from | 327 // will receive a handle to the MediaStream. This may be different from |
317 // MediaStreamRequest::render_process_id which in the tab capture case | 328 // MediaStreamRequest::render_process_id which in the tab capture case |
318 // specifies the target renderer from which audio and video is captured. | 329 // specifies the target renderer from which audio and video is captured. |
319 const int requesting_process_id; | 330 const int requesting_process_id; |
320 | 331 |
321 // The render frame id that requested this stream to be generated and that | 332 // The render frame id that requested this stream to be generated and that |
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2158 const url::Origin& origin) { | 2169 const url::Origin& origin) { |
2159 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 2170 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
2160 render_process_id, ConvertToGURL(origin))) { | 2171 render_process_id, ConvertToGURL(origin))) { |
2161 LOG(ERROR) << "MSM: Renderer requested a URL it's not allowed to use."; | 2172 LOG(ERROR) << "MSM: Renderer requested a URL it's not allowed to use."; |
2162 return false; | 2173 return false; |
2163 } | 2174 } |
2164 | 2175 |
2165 return true; | 2176 return true; |
2166 } | 2177 } |
2167 | 2178 |
| 2179 void MediaStreamManager::SetCapturingLinkSecured(int render_process_id, |
| 2180 int session_id, |
| 2181 content::MediaStreamType type, |
| 2182 bool is_secure) { |
| 2183 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 2184 |
| 2185 for (LabeledDeviceRequest& labeled_request : requests_) { |
| 2186 DeviceRequest* request = labeled_request.second; |
| 2187 if (request->requesting_process_id != render_process_id) |
| 2188 continue; |
| 2189 |
| 2190 for (const StreamDeviceInfo& device_info : request->devices) { |
| 2191 if (device_info.session_id == session_id && |
| 2192 device_info.device.type == type) { |
| 2193 request->SetCapturingLinkSecured(is_secure); |
| 2194 return; |
| 2195 } |
| 2196 } |
| 2197 } |
| 2198 } |
| 2199 |
2168 } // namespace content | 2200 } // namespace content |
OLD | NEW |