Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 1873293002: Report if video capturing meets output protection requirement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 const url::Origin& origin) { 2154 const url::Origin& origin) {
2144 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( 2155 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL(
2145 render_process_id, ConvertToGURL(origin))) { 2156 render_process_id, ConvertToGURL(origin))) {
2146 LOG(ERROR) << "MSM: Renderer requested a URL it's not allowed to use."; 2157 LOG(ERROR) << "MSM: Renderer requested a URL it's not allowed to use.";
2147 return false; 2158 return false;
2148 } 2159 }
2149 2160
2150 return true; 2161 return true;
2151 } 2162 }
2152 2163
2164 void MediaStreamManager::SetCapturingLinkSecured(int render_process_id,
2165 int session_id,
2166 content::MediaStreamType type,
2167 bool is_secure) {
2168 DCHECK_CURRENTLY_ON(BrowserThread::IO);
2169
2170 for (LabeledDeviceRequest& labeled_request : requests_) {
2171 DeviceRequest* request = labeled_request.second;
2172 if (request->requesting_process_id != render_process_id)
2173 continue;
2174
2175 for (const StreamDeviceInfo& device_info : request->devices) {
2176 if (device_info.session_id == session_id &&
2177 device_info.device.type == type) {
2178 request->SetCapturingLinkSecured(is_secure);
2179 return;
2180 }
2181 }
2182 }
2183 }
2184
2153 } // namespace content 2185 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698