Commit e76c304a authored by Joseph Arhar's avatar Joseph Arhar Committed by Commit Bot

Add FileTransferMessageHandlerFactory and file transfer capability

Bug: 
Change-Id: Iff14def9c9e2e8920ce9b13f1ec17dc50d1a4a86
Reviewed-on: https://chromium-review.googlesource.com/596614
Commit-Queue: Joseph Arhar <jarhar@google.com>
Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491609}
parent eb9c7f27
...@@ -137,6 +137,8 @@ static_library("host") { ...@@ -137,6 +137,8 @@ static_library("host") {
"dns_blackhole_checker.h", "dns_blackhole_checker.h",
"evaluate_capability.cc", "evaluate_capability.cc",
"evaluate_capability.h", "evaluate_capability.h",
"file_transfer_message_handler_factory.cc",
"file_transfer_message_handler_factory.h",
"forward_process_stats_agent.cc", "forward_process_stats_agent.cc",
"forward_process_stats_agent.h", "forward_process_stats_agent.h",
"gcd_rest_client.cc", "gcd_rest_client.cc",
...@@ -536,16 +538,20 @@ source_set("unit_tests") { ...@@ -536,16 +538,20 @@ source_set("unit_tests") {
} }
if (enable_me2me_host) { if (enable_me2me_host) {
sources += [ sources += [ "evaluate_capability_unittest.cc" ]
"evaluate_capability_unittest.cc",
]
if (is_win) { if (is_win) {
data_deps = [ "//remoting/host/win:remoting_me2me_host" ] data_deps = [
"//remoting/host/win:remoting_me2me_host",
]
} else if (is_mac) { } else if (is_mac) {
data_deps = [ "//remoting/host/mac:remoting_me2me_host" ] data_deps = [
"//remoting/host/mac:remoting_me2me_host",
]
} else { } else {
data_deps = [ ":remoting_me2me_host" ] data_deps = [
":remoting_me2me_host",
]
} }
} }
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "remoting/proto/control.pb.h" #include "remoting/proto/control.pb.h"
#include "remoting/proto/event.pb.h" #include "remoting/proto/event.pb.h"
#include "remoting/protocol/audio_stream.h" #include "remoting/protocol/audio_stream.h"
#include "remoting/protocol/capability_names.h"
#include "remoting/protocol/client_stub.h" #include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_thread_proxy.h" #include "remoting/protocol/clipboard_thread_proxy.h"
#include "remoting/protocol/pairing_registry.h" #include "remoting/protocol/pairing_registry.h"
...@@ -181,6 +182,13 @@ void ClientSession::SetCapabilities( ...@@ -181,6 +182,13 @@ void ClientSession::SetCapabilities(
extension_manager_->OnNegotiatedCapabilities( extension_manager_->OnNegotiatedCapabilities(
connection_->client_stub(), capabilities_); connection_->client_stub(), capabilities_);
if (HasCapability(capabilities_, protocol::kFileTransferCapability)) {
data_channel_manager_.RegisterCreateHandlerCallback(
kFileTransferDataChannelPrefix,
base::Bind(&FileTransferMessageHandlerFactory::CreateDataChannelHandler,
base::Unretained(&file_transfer_message_handler_factory_)));
}
VLOG(1) << "Client capabilities: " << *client_capabilities_; VLOG(1) << "Client capabilities: " << *client_capabilities_;
desktop_environment_->SetCapabilities(capabilities_); desktop_environment_->SetCapabilities(capabilities_);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "remoting/host/client_session_control.h" #include "remoting/host/client_session_control.h"
#include "remoting/host/client_session_details.h" #include "remoting/host/client_session_details.h"
#include "remoting/host/desktop_environment_options.h" #include "remoting/host/desktop_environment_options.h"
#include "remoting/host/file_transfer_message_handler_factory.h"
#include "remoting/host/host_experiment_session_plugin.h" #include "remoting/host/host_experiment_session_plugin.h"
#include "remoting/host/host_extension_session_manager.h" #include "remoting/host/host_extension_session_manager.h"
#include "remoting/host/remote_input_filter.h" #include "remoting/host/remote_input_filter.h"
...@@ -240,6 +241,9 @@ class ClientSession : public protocol::HostStub, ...@@ -240,6 +241,9 @@ class ClientSession : public protocol::HostStub,
// Used to dispatch new data channels to factory methods. // Used to dispatch new data channels to factory methods.
protocol::DataChannelManager data_channel_manager_; protocol::DataChannelManager data_channel_manager_;
// Used to handle file transfer data channels.
FileTransferMessageHandlerFactory file_transfer_message_handler_factory_;
// Set to true if the client was authenticated successfully. // Set to true if the client was authenticated successfully.
bool is_authenticated_ = false; bool is_authenticated_ = false;
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "remoting/host/file_transfer_message_handler_factory.h"
namespace remoting {
FileTransferMessageHandlerFactory::FileTransferMessageHandlerFactory() =
default;
FileTransferMessageHandlerFactory::~FileTransferMessageHandlerFactory() =
default;
void FileTransferMessageHandlerFactory::CreateDataChannelHandler(
const std::string& channel_name,
std::unique_ptr<protocol::MessagePipe> pipe) {
// TODO(jarhar): Implement FileTransferMessageHandler and pass pipe to it.
}
} // namespace remoting
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_HOST_FILE_TRANSFER_MESSAGE_HANDLER_FACTORY_H_
#define REMOTING_HOST_FILE_TRANSFER_MESSAGE_HANDLER_FACTORY_H_
#include <memory>
#include <string>
#include "remoting/protocol/message_pipe.h"
namespace remoting {
constexpr char kFileTransferDataChannelPrefix[] = "filetransfer-";
class FileTransferMessageHandlerFactory final {
public:
FileTransferMessageHandlerFactory();
~FileTransferMessageHandlerFactory();
void CreateDataChannelHandler(const std::string& channel_name,
std::unique_ptr<protocol::MessagePipe> pipe);
};
} // namespace remoting
#endif // REMOTING_HOST_FILE_TRANSFER_MESSAGE_HANDLER_FACTORY_H_
...@@ -56,6 +56,14 @@ std::string Me2MeDesktopEnvironment::GetCapabilities() const { ...@@ -56,6 +56,14 @@ std::string Me2MeDesktopEnvironment::GetCapabilities() const {
capabilities += " "; capabilities += " ";
capabilities += protocol::kTouchEventsCapability; capabilities += protocol::kTouchEventsCapability;
} }
// TODO(jarhar): Replace this ifdef with settings in DesktopEnvironmentOptions,
// and then a chrome policy.
#ifdef CHROME_REMOTE_DESKTOP_FILE_TRANSFER_ENABLED
capabilities += " ";
capabilities += protocol::kFileTransferCapability;
#endif
return capabilities; return capabilities;
} }
......
...@@ -14,6 +14,8 @@ const char kTouchEventsCapability[] = "touchEvents"; ...@@ -14,6 +14,8 @@ const char kTouchEventsCapability[] = "touchEvents";
const char kSendInitialResolution[] = "sendInitialResolution"; const char kSendInitialResolution[] = "sendInitialResolution";
const char kRateLimitResizeRequests[] = "rateLimitResizeRequests"; const char kRateLimitResizeRequests[] = "rateLimitResizeRequests";
const char kFileTransferCapability[] = "fileTransfer";
} // namespace protocol } // namespace protocol
} // namespace remoting } // namespace remoting
......
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