Commit 88f55637 authored by Lambros Lambrou's avatar Lambros Lambrou Committed by Commit Bot

Update remoting_start_host to use new Directory service.

This migrates the start_host tool to access the new Directory API
using gRPC.

Bug: 968326
Change-Id: Iac944cfe1d072b977f0d71feb7ad3e30f168e385
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636671
Auto-Submit: Lambros Lambrou <lambroslambrou@chromium.org>
Commit-Queue: Joe Downing <joedow@chromium.org>
Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664645}
parent 97d3c908
...@@ -20,6 +20,7 @@ include_rules = [ ...@@ -20,6 +20,7 @@ include_rules = [
"+services/device/public", "+services/device/public",
"+services/device/wake_lock/power_save_blocker", "+services/device/wake_lock/power_save_blocker",
"+services/network", "+services/network",
"+third_party/grpc",
"+third_party/jsoncpp", "+third_party/jsoncpp",
"+third_party/skia", "+third_party/skia",
"+third_party/webrtc", "+third_party/webrtc",
......
...@@ -45,6 +45,7 @@ source_set("common") { ...@@ -45,6 +45,7 @@ source_set("common") {
"//remoting/base:authorization", "//remoting/base:authorization",
"//remoting/host:common", "//remoting/host:common",
"//remoting/host/native_messaging", "//remoting/host/native_messaging",
"//remoting/proto/remoting/v1:directory_grpc_library",
"//services/network/public/cpp", "//services/network/public/cpp",
"//services/network/public/mojom", "//services/network/public/mojom",
] ]
......
...@@ -40,12 +40,11 @@ HostStarter::HostStarter( ...@@ -40,12 +40,11 @@ HostStarter::HostStarter(
HostStarter::~HostStarter() = default; HostStarter::~HostStarter() = default;
std::unique_ptr<HostStarter> HostStarter::Create( std::unique_ptr<HostStarter> HostStarter::Create(
const std::string& chromoting_hosts_url, const std::string& remoting_server_endpoint,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) { scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) {
return base::WrapUnique(new HostStarter( return base::WrapUnique(new HostStarter(
std::make_unique<gaia::GaiaOAuthClient>(url_loader_factory), std::make_unique<gaia::GaiaOAuthClient>(url_loader_factory),
std::make_unique<remoting::ServiceClient>(chromoting_hosts_url, std::make_unique<remoting::ServiceClient>(remoting_server_endpoint),
url_loader_factory),
remoting::DaemonController::Create())); remoting::DaemonController::Create()));
} }
......
...@@ -39,7 +39,7 @@ class HostStarter : public gaia::GaiaOAuthClient::Delegate, ...@@ -39,7 +39,7 @@ class HostStarter : public gaia::GaiaOAuthClient::Delegate,
// Creates a HostStarter. // Creates a HostStarter.
static std::unique_ptr<HostStarter> Create( static std::unique_ptr<HostStarter> Create(
const std::string& chromoting_hosts_url, const std::string& remoting_server_endpoint,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
// Registers a new host with the Chromoting service, and starts it. // Registers a new host with the Chromoting service, and starts it.
......
This diff is collapsed.
...@@ -10,10 +10,6 @@ ...@@ -10,10 +10,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
namespace network {
class SharedURLLoaderFactory;
}
// A class that gives access to the Chromoting service. // A class that gives access to the Chromoting service.
namespace remoting { namespace remoting {
...@@ -35,9 +31,8 @@ class ServiceClient { ...@@ -35,9 +31,8 @@ class ServiceClient {
protected: protected:
virtual ~Delegate() {} virtual ~Delegate() {}
}; };
ServiceClient(
const std::string& chromoting_hosts_url, explicit ServiceClient(const std::string& remoting_server_endpoint);
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
~ServiceClient(); ~ServiceClient();
// Register a host. // Register a host.
......
...@@ -231,7 +231,7 @@ int StartHostMain(int argc, char** argv) { ...@@ -231,7 +231,7 @@ int StartHostMain(int argc, char** argv) {
// Start the host. // Start the host.
std::unique_ptr<HostStarter> host_starter(HostStarter::Create( std::unique_ptr<HostStarter> host_starter(HostStarter::Create(
remoting::ServiceUrls::GetInstance()->directory_hosts_url(), remoting::ServiceUrls::GetInstance()->remoting_server_endpoint(),
url_loader_factory_owner.GetURLLoaderFactory())); url_loader_factory_owner.GetURLLoaderFactory()));
host_starter->StartHost(host_name, host_pin, host_starter->StartHost(host_name, host_pin,
/*consent_to_data_collection=*/true, auth_code, /*consent_to_data_collection=*/true, auth_code,
......
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