Chromium Code Reviews| Index: chrome/browser/media/desktop_capture_access_handler.cc |
| diff --git a/chrome/browser/media/desktop_capture_access_handler.cc b/chrome/browser/media/desktop_capture_access_handler.cc |
| index ff396ebabc724c6ddf1b1bcb2487d11b971737b2..7a2482b1000c05cb7989968d61484f20cb0979e7 100644 |
| --- a/chrome/browser/media/desktop_capture_access_handler.cc |
| +++ b/chrome/browser/media/desktop_capture_access_handler.cc |
| @@ -445,6 +445,11 @@ void DesktopCaptureAccessHandler::HandleRequest( |
| GetApplicationTitle(web_contents, extension), |
| base::UTF8ToUTF16(original_extension_name)); |
| + extension_whitelisted_ = MediaCaptureDevicesDispatcher::IsOriginForCasting( |
|
miu
2016/04/16 00:05:29
This value will be different for each session. In
xjz
2016/04/21 23:50:44
Done.
|
| + request.security_origin) || |
| + IsExtensionWhitelistedForScreenCapture(extension) || |
| + IsBuiltInExtension(request.security_origin); |
| + |
| callback.Run(devices, content::MEDIA_DEVICE_OK, std::move(ui)); |
| } |
| @@ -462,8 +467,8 @@ void DesktopCaptureAccessHandler::UpdateMediaRequestState( |
| return; |
| if (state == content::MEDIA_REQUEST_STATE_DONE) { |
| - DesktopCaptureSession session = { |
| - render_process_id, render_frame_id, page_request_id}; |
| + DesktopCaptureSession session = {render_process_id, render_frame_id, |
| + page_request_id, false}; |
| desktop_capture_sessions_.push_back(session); |
| } else if (state == content::MEDIA_REQUEST_STATE_CLOSING) { |
| for (DesktopCaptureSessions::iterator it = |
| @@ -482,3 +487,42 @@ void DesktopCaptureAccessHandler::UpdateMediaRequestState( |
| bool DesktopCaptureAccessHandler::IsCaptureInProgress() { |
| return desktop_capture_sessions_.size() > 0; |
| } |
| + |
| +bool DesktopCaptureAccessHandler::IsCaptureInProgress(int render_process_id, |
| + int render_frame_id, |
| + bool* is_link_secure) { |
| + *is_link_secure = false; |
| + if (desktop_capture_sessions_.size() <= 0) |
| + return false; |
| + for (DesktopCaptureSessions::iterator it = desktop_capture_sessions_.begin(); |
| + it != desktop_capture_sessions_.end(); ++it) { |
| + if (it->render_process_id == render_process_id && |
| + it->render_frame_id == render_frame_id) { |
|
miu
2016/04/16 00:05:29
You're not checking page_request_id here. So, sho
xjz
2016/04/21 23:50:44
Done. Check all sessions with same render frame.
|
| + *is_link_secure = it->is_capturing_link_secure && extension_whitelisted_; |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| +void DesktopCaptureAccessHandler::UpdateCapturingLinkSecured( |
| + int render_process_id, |
| + int render_frame_id, |
| + int page_request_id, |
| + content::MediaStreamType stream_type, |
|
miu
2016/04/16 00:05:29
IMO, passing and checking the stream_type here is
xjz
2016/04/21 23:50:44
Done.
|
| + bool is_secure) { |
| + if (stream_type != content::MEDIA_DESKTOP_VIDEO_CAPTURE) |
| + return; |
| + for (DesktopCaptureSessions::iterator it = desktop_capture_sessions_.begin(); |
| + it != desktop_capture_sessions_.end(); ++it) { |
| + if (it->render_process_id == render_process_id && |
| + it->render_frame_id == render_frame_id && |
| + it->page_request_id == page_request_id) { |
| + it->is_capturing_link_secure = is_secure; |
| + VLOG(1) << "DesktopCaptureAccessHandler:" |
| + << " render_process_id: " << render_process_id |
| + << " render_frame_id: " << render_frame_id |
| + << " is_capturing_link_secure: " << is_secure; |
| + } |
| + } |
| +} |