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

Side by Side Diff: chrome/browser/media/desktop_capture_access_handler.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. Rebased. Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/media/desktop_capture_access_handler.h" 5 #include "chrome/browser/media/desktop_capture_access_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 !base::CommandLine::ForCurrentProcess()->HasSwitch( 438 !base::CommandLine::ForCurrentProcess()->HasSwitch(
439 extensions::switches::kDisableDesktopCaptureAudio); 439 extensions::switches::kDisableDesktopCaptureAudio);
440 const bool capture_audio = 440 const bool capture_audio =
441 (check_audio_permission ? audio_permitted : true) && audio_requested && 441 (check_audio_permission ? audio_permitted : true) && audio_requested &&
442 audio_supported; 442 audio_supported;
443 443
444 ui = GetDevicesForDesktopCapture(&devices, media_id, capture_audio, true, 444 ui = GetDevicesForDesktopCapture(&devices, media_id, capture_audio, true,
445 GetApplicationTitle(web_contents, extension), 445 GetApplicationTitle(web_contents, extension),
446 base::UTF8ToUTF16(original_extension_name)); 446 base::UTF8ToUTF16(original_extension_name));
447 447
448 bool is_extension_trusted =
miu 2016/04/26 01:25:13 Consider rolling this into CaptureAccessHandlerBas
xjz 2016/04/29 00:11:42 Done.
449 MediaCaptureDevicesDispatcher::IsOriginForCasting(
450 request.security_origin) ||
451 IsExtensionWhitelistedForScreenCapture(extension) ||
452 IsBuiltInExtension(request.security_origin);
453 UpdateExtensionTrusted(request.render_process_id, request.render_frame_id,
454 request.page_request_id, is_extension_trusted);
455
448 callback.Run(devices, content::MEDIA_DEVICE_OK, std::move(ui)); 456 callback.Run(devices, content::MEDIA_DEVICE_OK, std::move(ui));
449 } 457 }
450 458
451 void DesktopCaptureAccessHandler::UpdateMediaRequestState(
452 int render_process_id,
453 int render_frame_id,
454 int page_request_id,
455 content::MediaStreamType stream_type,
456 content::MediaRequestState state) {
457 DCHECK_CURRENTLY_ON(BrowserThread::UI);
458 // Track desktop capture sessions. Tracking is necessary to avoid unbalanced
459 // session counts since not all requests will reach MEDIA_REQUEST_STATE_DONE,
460 // but they will all reach MEDIA_REQUEST_STATE_CLOSING.
461 if (stream_type != content::MEDIA_DESKTOP_VIDEO_CAPTURE)
462 return;
463
464 if (state == content::MEDIA_REQUEST_STATE_DONE) {
465 DesktopCaptureSession session = {
466 render_process_id, render_frame_id, page_request_id};
467 desktop_capture_sessions_.push_back(session);
468 } else if (state == content::MEDIA_REQUEST_STATE_CLOSING) {
469 for (DesktopCaptureSessions::iterator it =
470 desktop_capture_sessions_.begin();
471 it != desktop_capture_sessions_.end(); ++it) {
472 if (it->render_process_id == render_process_id &&
473 it->render_frame_id == render_frame_id &&
474 it->page_request_id == page_request_id) {
475 desktop_capture_sessions_.erase(it);
476 break;
477 }
478 }
479 }
480 }
481
482 bool DesktopCaptureAccessHandler::IsCaptureInProgress() {
483 return desktop_capture_sessions_.size() > 0;
484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698