Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: remoting/host/chromoting_host.cc

Issue 9004050: Move signaling connection creation out of ChromotingHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/chromoting_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 3633d238daf970bb0bc6e07f093ece6d074ac281..b16a83ce290ec13ad03024577b6847eef19982e5 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
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/chromoting_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698