#include "content/public/browser/desktop_capture.h"
#include "base/feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/media/video_capture_manager.h"
#include "content/common/features.h"
#include "content/public/common/content_features.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "content/browser/media/capture/desktop_capturer_lacros.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "content/browser/media/capture/aura_window_to_mojo_device_adapter.h"
#include "content/browser/media/capture/desktop_capturer_ash.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#endif
#if defined(WEBRTC_USE_PIPEWIRE)
#include "base/environment.h"
#include "base/nix/xdg_util.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/win/windows_version.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
BASE_FEATURE(kUseCGDisplayStreamCreateSonoma,
"UseCGDisplayStreamCreateSonoma",
base::FEATURE_DISABLED_BY_DEFAULT);
bool CGDisplayStreamCreateIsAvailable() {
if (base::mac::MacOSMajorVersion() >= 14) {
return base::FeatureList::IsEnabled(kUseCGDisplayStreamCreateSonoma);
}
return true;
}
#endif
namespace content::desktop_capture {
webrtc::DesktopCaptureOptions CreateDesktopCaptureOptions() { … }
std::unique_ptr<webrtc::DesktopCapturer> CreateScreenCapturer(
bool allow_wgc_screen_capturer) { … }
std::unique_ptr<webrtc::DesktopCapturer> CreateWindowCapturer() { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void BindAuraWindowCapturer(
mojo::PendingReceiver<video_capture::mojom::Device> receiver,
const content::DesktopMediaID& id) {
mojo::MakeSelfOwnedReceiver(
std::make_unique<AuraWindowToMojoDeviceAdapter>(id), std::move(receiver));
}
#endif
bool CanUsePipeWire() { … }
bool ShouldEnumerateCurrentProcessWindows() { … }
void OpenNativeScreenCapturePicker(
content::DesktopMediaID::Type type,
base::OnceCallback<void(webrtc::DesktopCapturer::Source)> picker_callback,
base::OnceCallback<void()> cancel_callback,
base::OnceCallback<void()> error_callback) { … }
}