#include "chrome/browser/media/capture_access_handler_base.h"
#include <string>
#include <utility>
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/common/webui_url_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/extension.h"
#include "ui/gfx/native_widget_types.h"
#if defined(USE_AURA)
#include "ui/aura/window.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "base/hash/sha1.h"
#include "base/strings/string_number_conversions.h"
#endif
BrowserThread;
struct CaptureAccessHandlerBase::Session { … };
CaptureAccessHandlerBase::PendingAccessRequest::PendingAccessRequest(
std::unique_ptr<DesktopMediaPicker> picker,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback,
std::u16string application_title,
bool should_display_notification,
bool is_allowlisted_extension)
: … { … }
CaptureAccessHandlerBase::PendingAccessRequest::~PendingAccessRequest() =
default;
CaptureAccessHandlerBase::CaptureAccessHandlerBase() = default;
CaptureAccessHandlerBase::~CaptureAccessHandlerBase() = default;
void CaptureAccessHandlerBase::AddCaptureSession(int render_process_id,
int render_frame_id,
int page_request_id,
bool is_trusted) { … }
void CaptureAccessHandlerBase::RemoveCaptureSession(int render_process_id,
int render_frame_id,
int page_request_id) { … }
std::list<CaptureAccessHandlerBase::Session>::iterator
CaptureAccessHandlerBase::FindSession(int render_process_id,
int render_frame_id,
int page_request_id) { … }
void CaptureAccessHandlerBase::UpdateMediaRequestState(
int render_process_id,
int render_frame_id,
int page_request_id,
blink::mojom::MediaStreamType stream_type,
content::MediaRequestState state) { … }
void CaptureAccessHandlerBase::UpdateExtensionTrusted(
const content::MediaStreamRequest& request,
bool is_allowlisted_extension) { … }
void CaptureAccessHandlerBase::UpdateTrusted(
const content::MediaStreamRequest& request,
bool is_trusted) { … }
void CaptureAccessHandlerBase::UpdateTarget(
const content::MediaStreamRequest& request,
const content::DesktopMediaID& target) { … }
bool CaptureAccessHandlerBase::IsInsecureCapturingInProgress(
int render_process_id,
int render_frame_id) { … }
bool CaptureAccessHandlerBase::MatchesSession(const Session& session,
int target_process_id,
int target_frame_id) { … }
void CaptureAccessHandlerBase::UpdateVideoScreenCaptureStatus(
int render_process_id,
int render_frame_id,
int page_request_id,
bool is_secure) { … }
bool CaptureAccessHandlerBase::IsExtensionAllowedForScreenCapture(
const extensions::Extension* extension) { … }
bool CaptureAccessHandlerBase::IsBuiltInFeedbackUI(const GURL& origin) { … }