#include "content/browser/media/capture_handle_manager.h"
#include "base/memory/ptr_util.h"
#include "base/ranges/algorithm.h"
#include "content/browser/renderer_host/render_frame_host_delegate.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "url/origin.h"
namespace content {
namespace {
media::mojom::CaptureHandlePtr CreateCaptureHandle(
RenderFrameHostImpl* capturer,
WebContents* captured,
const blink::mojom::CaptureHandleConfig& capture_handle_config) { … }
bool IsEqual(const media::mojom::CaptureHandlePtr& lhs,
const media::mojom::CaptureHandlePtr& rhs) { … }
}
class CaptureHandleManager::Observer final : public WebContentsObserver { … };
std::unique_ptr<CaptureHandleManager::Observer>
CaptureHandleManager::Observer::Create(
const CaptureKey& capture_key,
GlobalRenderFrameHostId captured,
GlobalRenderFrameHostId capturer,
DeviceCaptureHandleChangeCallback handle_change_callback) { … }
CaptureHandleManager::Observer::Observer(
WebContents* web_contents,
const CaptureKey& capture_key,
GlobalRenderFrameHostId capturer,
DeviceCaptureHandleChangeCallback handle_change_callback)
: … { … }
CaptureHandleManager::Observer::~Observer() = default;
void CaptureHandleManager::Observer::OnCaptureHandleConfigUpdate(
const blink::mojom::CaptureHandleConfig& config) { … }
void CaptureHandleManager::Observer::UpdateCaptureHandleConfig() { … }
CaptureHandleManager::CaptureInfo::CaptureInfo(
std::unique_ptr<Observer> observer,
media::mojom::CaptureHandlePtr last_capture_handle,
DeviceCaptureHandleChangeCallback callback)
: … { … }
CaptureHandleManager::CaptureInfo::~CaptureInfo() = default;
CaptureHandleManager::CaptureHandleManager() { … }
CaptureHandleManager::~CaptureHandleManager() { … }
void CaptureHandleManager::OnTabCaptureStarted(
const std::string& label,
const blink::MediaStreamDevice& captured_device,
GlobalRenderFrameHostId capturer,
DeviceCaptureHandleChangeCallback handle_change_callback) { … }
void CaptureHandleManager::OnTabCaptureStopped(
const std::string& label,
const blink::MediaStreamDevice& captured_device) { … }
void CaptureHandleManager::OnTabCaptureDevicesUpdated(
const std::string& label,
blink::mojom::StreamDevicesSetPtr new_stream_devices_set,
GlobalRenderFrameHostId capturer,
DeviceCaptureHandleChangeCallback handle_change_callback) { … }
void CaptureHandleManager::OnCaptureHandleConfigUpdate(
const std::string& label,
blink::mojom::MediaStreamType type,
media::mojom::CaptureHandlePtr capture_handle) { … }
}