Index: remoting/host/it2me/it2me_host.cc |
diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc |
index d1528c3cf73845ff8a65074ed66fb0f98696c367..e1c7a5fea255bad73b86a8744c0a7c2cdc33a559 100644 |
--- a/remoting/host/it2me/it2me_host.cc |
+++ b/remoting/host/it2me/it2me_host.cc |
@@ -15,7 +15,6 @@ |
#include "base/strings/string_util.h" |
#include "base/threading/platform_thread.h" |
#include "components/policy/policy_constants.h" |
-#include "net/socket/client_socket_factory.h" |
#include "net/url_request/url_request_context_getter.h" |
#include "remoting/base/auto_thread.h" |
#include "remoting/base/chromium_url_request.h" |
@@ -61,11 +60,13 @@ It2MeHost::It2MeHost( |
std::unique_ptr<PolicyWatcher> policy_watcher, |
std::unique_ptr<It2MeConfirmationDialog> confirmation_dialog, |
base::WeakPtr<It2MeHost::Observer> observer, |
- const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
+ std::unique_ptr<SignalStrategy> signal_strategy, |
+ const std::string& username, |
const std::string& directory_bot_jid) |
: host_context_(std::move(host_context)), |
observer_(observer), |
- xmpp_server_config_(xmpp_server_config), |
+ signal_strategy_(std::move(signal_strategy)), |
+ username_(username), |
directory_bot_jid_(directory_bot_jid), |
policy_watcher_(std::move(policy_watcher)), |
confirmation_dialog_(std::move(confirmation_dialog)) { |
@@ -173,8 +174,7 @@ void It2MeHost::FinishConnect() { |
// Check the host domain policy. |
if (!required_host_domain_.empty() && |
- !base::EndsWith(xmpp_server_config_.username, |
- std::string("@") + required_host_domain_, |
+ !base::EndsWith(username_, std::string("@") + required_host_domain_, |
base::CompareCase::INSENSITIVE_ASCII)) { |
SetState(kInvalidDomainError, ""); |
return; |
@@ -184,19 +184,13 @@ void It2MeHost::FinishConnect() { |
// TODO(wez): Move this to the worker thread. |
host_key_pair_ = RsaKeyPair::Generate(); |
- // Create XMPP connection. |
- std::unique_ptr<SignalStrategy> signal_strategy(new XmppSignalStrategy( |
- net::ClientSocketFactory::GetDefaultFactory(), |
- host_context_->url_request_context_getter(), xmpp_server_config_)); |
- |
// Request registration of the host for support. |
std::unique_ptr<RegisterSupportHostRequest> register_request( |
new RegisterSupportHostRequest( |
- signal_strategy.get(), host_key_pair_, directory_bot_jid_, |
+ signal_strategy_.get(), host_key_pair_, directory_bot_jid_, |
base::Bind(&It2MeHost::OnReceivedSupportID, base::Unretained(this)))); |
// Beyond this point nothing can fail, so save the config and request. |
- signal_strategy_ = std::move(signal_strategy); |
register_request_ = std::move(register_request); |
// If NAT traversal is off then limit port range to allow firewall pin-holing. |
@@ -249,7 +243,7 @@ void It2MeHost::FinishConnect() { |
// Connect signaling and start the host. |
signal_strategy_->Connect(); |
- host_->Start(xmpp_server_config_.username); |
+ host_->Start(username_); |
SetState(kRequestedAccessCode, ""); |
return; |
@@ -551,7 +545,8 @@ scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost( |
std::unique_ptr<ChromotingHostContext> context, |
policy::PolicyService* policy_service, |
base::WeakPtr<It2MeHost::Observer> observer, |
- const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
+ std::unique_ptr<SignalStrategy> signal_strategy, |
+ const std::string& username, |
const std::string& directory_bot_jid) { |
DCHECK(context->ui_task_runner()->BelongsToCurrentThread()); |
@@ -559,7 +554,7 @@ scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost( |
PolicyWatcher::Create(policy_service, context->file_task_runner()); |
return new It2MeHost(std::move(context), std::move(policy_watcher), |
It2MeConfirmationDialog::Create(), observer, |
- xmpp_server_config, directory_bot_jid); |
+ std::move(signal_strategy), username, directory_bot_jid); |
} |
} // namespace remoting |