#include "remoting/host/chromoting_host.h"
#include <stddef.h>
#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "components/named_mojo_ipc_server/connection_info.h"
#include "components/named_mojo_ipc_server/endpoint_options.h"
#include "components/named_mojo_ipc_server/named_mojo_ipc_server.h"
#include "components/webrtc/thread_wrapper.h"
#include "remoting/base/constants.h"
#include "remoting/base/local_session_policies_provider.h"
#include "remoting/base/logging.h"
#include "remoting/host/desktop_environment.h"
#include "remoting/host/host_config.h"
#include "remoting/host/input_injector.h"
#include "remoting/host/ipc_constants.h"
#include "remoting/host/mojo_caller_security_checker.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/host_stub.h"
#include "remoting/protocol/ice_connection_to_client.h"
#include "remoting/protocol/input_stub.h"
#include "remoting/protocol/transport_context.h"
#include "remoting/protocol/webrtc_connection_to_client.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include "base/strings/stringprintf.h"
#include "base/win/win_util.h"
#endif
ConnectionToClient;
InputStub;
namespace remoting {
namespace {
const net::BackoffEntry::Policy kDefaultBackoffPolicy = …;
}
ChromotingHost::ChromotingHost(
DesktopEnvironmentFactory* desktop_environment_factory,
std::unique_ptr<protocol::SessionManager> session_manager,
scoped_refptr<protocol::TransportContext> transport_context,
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
const DesktopEnvironmentOptions& options,
const LocalSessionPoliciesProvider* local_session_policies_provider)
: … { … }
ChromotingHost::~ChromotingHost() { … }
void ChromotingHost::Start(const std::string& host_owner_email) { … }
#if BUILDFLAG(IS_LINUX)
void ChromotingHost::StartChromotingHostServices() { … }
#endif
void ChromotingHost::BindChromotingHostServices(
mojo::PendingReceiver<mojom::ChromotingHostServices> receiver,
base::ProcessId peer_pid) { … }
void ChromotingHost::AddExtension(std::unique_ptr<HostExtension> extension) { … }
void ChromotingHost::SetAuthenticatorFactory(
std::unique_ptr<protocol::AuthenticatorFactory> authenticator_factory) { … }
void ChromotingHost::OnSessionAuthenticating(ClientSession* client) { … }
void ChromotingHost::OnSessionAuthenticated(ClientSession* client) { … }
void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) { … }
void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) { … }
void ChromotingHost::OnSessionClosed(ClientSession* client) { … }
void ChromotingHost::OnSessionRouteChange(
ClientSession* session,
const std::string& channel_name,
const protocol::TransportRoute& route) { … }
void ChromotingHost::BindSessionServices(
mojo::PendingReceiver<mojom::ChromotingSessionServices> receiver) { … }
void ChromotingHost::OnIncomingSession(
protocol::Session* session,
protocol::SessionManager::IncomingSessionResponse* response) { … }
ClientSession* ChromotingHost::GetConnectedClientSession() const { … }
}