#include "remoting/host/it2me/it2me_host.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/policy_constants.h"
#include "components/webrtc/thread_wrapper.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "remoting/base/auto_thread_task_runner.h"
#include "remoting/base/local_session_policies_provider.h"
#include "remoting/base/logging.h"
#include "remoting/base/oauth_token_getter.h"
#include "remoting/base/rsa_key_pair.h"
#include "remoting/base/session_policies.h"
#include "remoting/host/chromeos/chromeos_enterprise_params.h"
#include "remoting/host/chromoting_host.h"
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/ftl_signaling_connector.h"
#include "remoting/host/host_event_logger.h"
#include "remoting/host/host_event_reporter.h"
#include "remoting/host/host_secret.h"
#include "remoting/host/host_status_logger.h"
#include "remoting/host/it2me/it2me_confirmation_dialog.h"
#include "remoting/host/it2me/it2me_helpers.h"
#include "remoting/host/it2me_desktop_environment.h"
#include "remoting/host/passthrough_register_support_host_request.h"
#include "remoting/host/session_policies_from_dict.h"
#include "remoting/proto/ftl/v1/chromoting_message.pb.h"
#include "remoting/protocol/auth_util.h"
#include "remoting/protocol/chromium_port_allocator_factory.h"
#include "remoting/protocol/it2me_host_authenticator_factory.h"
#include "remoting/protocol/jingle_session_manager.h"
#include "remoting/protocol/transport_context.h"
#include "remoting/protocol/validating_authenticator.h"
#include "remoting/signaling/log_to_server.h"
#include "remoting/signaling/signaling_address.h"
#include "remoting/signaling/signaling_id_util.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "base/feature_list.h"
#include "remoting/host/chromeos/features.h"
#endif
#if BUILDFLAG(IS_LINUX)
#include "remoting/host/linux/wayland_manager.h"
#include "remoting/host/linux/wayland_utils.h"
#endif
namespace remoting {
ErrorCode;
namespace {
const char kApplicationName[] = …;
const int kMaxLoginAttempts = …;
ValidatingAuthenticator;
ValidationResult;
ValidationCallback;
ValidationResultCallback;
constexpr base::TimeDelta kDestroySignalingDelay = …;
}
It2MeHost::DeferredConnectContext::DeferredConnectContext() = default;
It2MeHost::DeferredConnectContext::~DeferredConnectContext() = default;
It2MeHost::It2MeHost() { … }
It2MeHost::~It2MeHost() { … }
void It2MeHost::set_chrome_os_enterprise_params(
ChromeOsEnterpriseParams params) { … }
void It2MeHost::set_authorized_helper(const std::string& authorized_helper) { … }
void It2MeHost::set_reconnect_params(ReconnectParams reconnect_params) { … }
bool It2MeHost::SessionSupportsReconnections() const { … }
std::optional<ReconnectParams> It2MeHost::CreateReconnectParams() const { … }
void It2MeHost::SendReconnectSessionMessage() const { … }
void It2MeHost::Connect(
std::unique_ptr<ChromotingHostContext> host_context,
base::Value::Dict policies,
std::unique_ptr<It2MeConfirmationDialogFactory> dialog_factory,
base::WeakPtr<It2MeHost::Observer> observer,
CreateDeferredConnectContext create_context,
const std::string& username,
const protocol::IceConfig& ice_config) { … }
void It2MeHost::Disconnect() { … }
void It2MeHost::ConnectOnNetworkThread(
const std::string& username,
const protocol::IceConfig& ice_config,
CreateDeferredConnectContext create_context) { … }
void It2MeHost::OnClientAccessDenied(const std::string& signaling_id) { … }
void It2MeHost::OnClientConnected(const std::string& signaling_id) { … }
void It2MeHost::OnClientDisconnected(const std::string& signaling_id) { … }
ValidationCallback It2MeHost::GetValidationCallbackForTesting() { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void It2MeHost::SetHostEventReporterFactoryForTesting(
HostEventReporterFactory factory) {
host_event_reporter_factory_ = factory;
}
#endif
void It2MeHost::OnPolicyUpdate(base::Value::Dict policies) { … }
void It2MeHost::UpdateNatPolicies(bool nat_policy_value,
bool relay_policy_value) { … }
void It2MeHost::UpdateHostDomainListPolicy(
std::vector<std::string> host_domain_list) { … }
void It2MeHost::UpdateClientDomainListPolicy(
std::vector<std::string> client_domain_list) { … }
void It2MeHost::UpdateSessionPolicies(
const base::Value::Dict& platform_policies) { … }
void It2MeHost::SetState(It2MeHostState state, ErrorCode error_code) { … }
bool It2MeHost::IsRunning() const { … }
void It2MeHost::OnReceivedSupportID(const std::string& support_id,
const base::TimeDelta& lifetime,
const ErrorCode error_code) { … }
void It2MeHost::DisconnectOnNetworkThread(protocol::ErrorCode error_code) { … }
void It2MeHost::ValidateConnectionDetails(
const std::string& original_remote_jid,
ValidationResultCallback result_callback) { … }
void It2MeHost::OnConfirmationResult(ValidationResultCallback result_callback,
It2MeConfirmationDialog::Result result) { … }
const char* It2MeHost::GetRemoteSupportPolicyKey() const { … }
It2MeHostFactory::It2MeHostFactory() = default;
It2MeHostFactory::~It2MeHostFactory() = default;
std::unique_ptr<It2MeHostFactory> It2MeHostFactory::Clone() const { … }
scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost() { … }
}