#include "remoting/host/basic_desktop_environment.h"
#include <memory>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "remoting/host/action_executor.h"
#include "remoting/host/active_display_monitor.h"
#include "remoting/host/audio_capturer.h"
#include "remoting/host/base/screen_controls.h"
#include "remoting/host/client_session_control.h"
#include "remoting/host/desktop_and_cursor_conditional_composer.h"
#include "remoting/host/desktop_capturer_proxy.h"
#include "remoting/host/desktop_capturer_wrapper.h"
#include "remoting/host/desktop_display_info_monitor.h"
#include "remoting/host/file_transfer/local_file_operations.h"
#include "remoting/host/input_injector.h"
#include "remoting/host/keyboard_layout_monitor.h"
#include "remoting/host/mouse_cursor_monitor_proxy.h"
#include "remoting/host/remote_open_url/url_forwarder_configurator.h"
#include "remoting/host/webauthn/remote_webauthn_extension_notifier.h"
#include "remoting/protocol/capability_names.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
#include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
#include "base/logging.h"
#if BUILDFLAG(IS_WIN)
#include "remoting/host/win/evaluate_d3d.h"
#endif
#if defined(REMOTING_USE_X11)
#include "base/threading/watchdog.h"
#include "remoting/host/linux/wayland_utils.h"
#include "remoting/host/linux/x11_util.h"
#endif
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
namespace remoting {
#if defined(REMOTING_USE_X11)
namespace {
constexpr base::TimeDelta kWaitForIgnoreXServerGrabsTimeout = …;
class IgnoreXServerGrabsWatchdog : public base::Watchdog::Delegate { … };
}
#endif
BasicDesktopEnvironment::~BasicDesktopEnvironment() { … }
std::unique_ptr<ActionExecutor>
BasicDesktopEnvironment::CreateActionExecutor() { … }
std::unique_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() { … }
std::unique_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() { … }
std::unique_ptr<ScreenControls>
BasicDesktopEnvironment::CreateScreenControls() { … }
DesktopDisplayInfoMonitor* BasicDesktopEnvironment::GetDisplayInfoMonitor() { … }
std::unique_ptr<webrtc::MouseCursorMonitor>
BasicDesktopEnvironment::CreateMouseCursorMonitor() { … }
std::unique_ptr<KeyboardLayoutMonitor>
BasicDesktopEnvironment::CreateKeyboardLayoutMonitor(
base::RepeatingCallback<void(const protocol::KeyboardLayout&)> callback) { … }
std::unique_ptr<ActiveDisplayMonitor>
BasicDesktopEnvironment::CreateActiveDisplayMonitor(
ActiveDisplayMonitor::Callback callback) { … }
std::unique_ptr<FileOperations>
BasicDesktopEnvironment::CreateFileOperations() { … }
std::unique_ptr<UrlForwarderConfigurator>
BasicDesktopEnvironment::CreateUrlForwarderConfigurator() { … }
std::string BasicDesktopEnvironment::GetCapabilities() const { … }
void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) { … }
uint32_t BasicDesktopEnvironment::GetDesktopSessionId() const { … }
std::unique_ptr<RemoteWebAuthnStateChangeNotifier>
BasicDesktopEnvironment::CreateRemoteWebAuthnStateChangeNotifier() { … }
std::unique_ptr<DesktopCapturer> BasicDesktopEnvironment::CreateVideoCapturer(
webrtc::ScreenId id) { … }
BasicDesktopEnvironment::BasicDesktopEnvironment(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control,
const DesktopEnvironmentOptions& options)
: … { … }
BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
: … { … }
BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() = default;
bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { … }
}