diff options
Diffstat (limited to 'remoting/host/chromoting_host.cc')
-rw-r--r-- | remoting/host/chromoting_host.cc | 64 |
1 files changed, 5 insertions, 59 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 3633d23..b16a83ce 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -18,7 +18,6 @@ #include "remoting/host/event_executor.h" #include "remoting/host/host_config.h" #include "remoting/host/screen_recorder.h" -#include "remoting/jingle_glue/xmpp_signal_strategy.h" #include "remoting/protocol/connection_to_client.h" #include "remoting/protocol/client_stub.h" #include "remoting/protocol/host_stub.h" @@ -32,16 +31,9 @@ using remoting::protocol::InputStub; namespace remoting { -// static -ChromotingHost* ChromotingHost::Create(ChromotingHostContext* context, - MutableHostConfig* config, - DesktopEnvironment* environment, - bool allow_nat_traversal) { - return new ChromotingHost(context, config, environment, allow_nat_traversal); -} - ChromotingHost::ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, + SignalStrategy* signal_strategy, DesktopEnvironment* environment, bool allow_nat_traversal) : context_(context), @@ -49,10 +41,13 @@ ChromotingHost::ChromotingHost(ChromotingHostContext* context, config_(config), allow_nat_traversal_(allow_nat_traversal), have_shared_secret_(false), + signal_strategy_(signal_strategy), stopping_recorders_(0), state_(kInitial), protocol_config_(protocol::CandidateSessionConfig::CreateDefault()), is_it2me_(false) { + DCHECK(context_); + DCHECK(signal_strategy); DCHECK(desktop_environment_); desktop_environment_->set_host(this); } @@ -69,7 +64,6 @@ void ChromotingHost::Start() { } LOG(INFO) << "Starting host"; - DCHECK(!signal_strategy_.get()); // Make sure this object is not started. if (state_ != kInitial) @@ -82,29 +76,10 @@ void ChromotingHost::Start() { return; } - // Use an XMPP connection to the Talk network for session signalling. - std::string xmpp_login; - std::string xmpp_auth_token; - std::string xmpp_auth_service; - if (!config_->GetString(kXmppLoginConfigPath, &xmpp_login) || - !config_->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token) || - !config_->GetString(kXmppAuthServiceConfigPath, &xmpp_auth_service)) { - LOG(ERROR) << "XMPP credentials are not defined in the config."; - return; - } - - // Create and start XMPP connection. - signal_strategy_.reset( - new XmppSignalStrategy(context_->jingle_thread(), xmpp_login, - xmpp_auth_token, xmpp_auth_service)); - signal_strategy_->AddListener(this); - signal_strategy_->Connect(); - // Create and start session manager. session_manager_.reset( new protocol::JingleSessionManager(context_->network_message_loop())); - session_manager_->Init(signal_strategy_.get(), - this, allow_nat_traversal_); + session_manager_->Init(signal_strategy_, this, allow_nat_traversal_); } // This method is called when we need to destroy the host process. @@ -145,13 +120,6 @@ void ChromotingHost::Shutdown(const base::Closure& shutdown_task) { have_shared_secret_ = false; } - // Stop XMPP connection synchronously. - if (signal_strategy_.get()) { - signal_strategy_->Disconnect(); - signal_strategy_->RemoveListener(this); - signal_strategy_.reset(); - } - if (recorder_.get()) { StopScreenRecorder(); } else { @@ -254,28 +222,6 @@ void ChromotingHost::OnSessionSequenceNumber(ClientSession* session, recorder_->UpdateSequenceNumber(sequence_number); } -//////////////////////////////////////////////////////////////////////////// -// SignalStrategy::StatusObserver implementations -void ChromotingHost::OnSignalStrategyStateChange( - SignalStrategy::State state) { - DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); - - if (state == SignalStrategy::CONNECTED) { - LOG(INFO) << "Host connected as " << signal_strategy_->GetLocalJid(); - - for (StatusObserverList::iterator it = status_observers_.begin(); - it != status_observers_.end(); ++it) { - (*it)->OnSignallingConnected(signal_strategy_.get()); - } - } else if (state == SignalStrategy::DISCONNECTED) { - LOG(INFO) << "Host disconnected from talk network."; - for (StatusObserverList::iterator it = status_observers_.begin(); - it != status_observers_.end(); ++it) { - (*it)->OnSignallingDisconnected(); - } - } -} - void ChromotingHost::OnSessionManagerReady() { DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); // Don't need to do anything here, just wait for incoming |