Commit f050b8de authored by Lambros Lambrou's avatar Lambros Lambrou Committed by Commit Bot

[remoting host] Enable sending of the RTC event log.

This creates a new FileTransferMessageHandler on a separate data
channel, which can send the host's RTC event log as a file-download.

Bug: 1122798
Change-Id: Icb76e63a790054c45d540c5f20222edbd2086b4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450891
Commit-Queue: Lambros Lambrou <lambroslambrou@chromium.org>
Reviewed-by: default avatarErik Jensen <rkjnsn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814511}
parent d55b46e0
......@@ -23,6 +23,7 @@
#include "remoting/host/audio_capturer.h"
#include "remoting/host/desktop_environment.h"
#include "remoting/host/file_transfer/file_transfer_message_handler.h"
#include "remoting/host/file_transfer/rtc_log_file_operations.h"
#include "remoting/host/host_extension_session.h"
#include "remoting/host/input_injector.h"
#include "remoting/host/keyboard_layout_monitor.h"
......@@ -42,6 +43,10 @@
#include "remoting/protocol/video_frame_pump.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
namespace {
constexpr char kRtcLogTransferDataChannelPrefix[] = "rtc-log-transfer-";
} // namespace
namespace remoting {
using protocol::ActionRequest;
......@@ -185,6 +190,13 @@ void ClientSession::SetCapabilities(
base::Unretained(this)));
}
if (HasCapability(capabilities_, protocol::kRtcLogTransferCapability)) {
data_channel_manager_.RegisterCreateHandlerCallback(
kRtcLogTransferDataChannelPrefix,
base::BindRepeating(&ClientSession::CreateRtcLogTransferMessageHandler,
base::Unretained(this)));
}
std::vector<ActionRequest::Action> supported_actions;
if (HasCapability(capabilities_, protocol::kSendAttentionSequenceAction))
supported_actions.push_back(ActionRequest::SEND_ATTENTION_SEQUENCE);
......@@ -832,6 +844,14 @@ void ClientSession::CreateFileTransferMessageHandler(
desktop_environment_->CreateFileOperations());
}
void ClientSession::CreateRtcLogTransferMessageHandler(
const std::string& channel_name,
std::unique_ptr<protocol::MessagePipe> pipe) {
new FileTransferMessageHandler(
channel_name, std::move(pipe),
std::make_unique<RtcLogFileOperations>(connection_.get()));
}
void ClientSession::CreateActionMessageHandler(
std::vector<ActionRequest::Action> capabilities,
const std::string& channel_name,
......
......@@ -203,6 +203,10 @@ class ClientSession : public protocol::HostStub,
const std::string& channel_name,
std::unique_ptr<protocol::MessagePipe> pipe);
void CreateRtcLogTransferMessageHandler(
const std::string& channel_name,
std::unique_ptr<protocol::MessagePipe> pipe);
EventHandler* event_handler_;
// Used to create a DesktopEnvironment instance for this session.
......
......@@ -85,7 +85,11 @@ It2MeDesktopEnvironment::It2MeDesktopEnvironment(
}
std::string It2MeDesktopEnvironment::GetCapabilities() const {
return protocol::kWebrtcIceSdpRestartAction;
std::string capabilities;
capabilities += protocol::kWebrtcIceSdpRestartAction;
capabilities += " ";
capabilities += protocol::kRtcLogTransferCapability;
return capabilities;
}
It2MeDesktopEnvironmentFactory::It2MeDesktopEnvironmentFactory(
......
......@@ -67,6 +67,9 @@ std::string Me2MeDesktopEnvironment::GetCapabilities() const {
capabilities += " ";
capabilities += protocol::kWebrtcIceSdpRestartAction;
capabilities += " ";
capabilities += protocol::kRtcLogTransferCapability;
if (InputInjector::SupportsTouchEvents()) {
capabilities += " ";
capabilities += protocol::kTouchEventsCapability;
......
......@@ -15,6 +15,7 @@ constexpr char kSendInitialResolution[] = "sendInitialResolution";
constexpr char kRateLimitResizeRequests[] = "rateLimitResizeRequests";
constexpr char kFileTransferCapability[] = "fileTransfer";
constexpr char kRtcLogTransferCapability[] = "rtcLogTransfer";
// TODO(joedow): Ideally these would be dynamically created via the
// DataChannelManager, we should consider moving them there if we begin using
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment