diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-29 22:31:04 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-29 22:31:04 +0000 |
commit | b6e2d6a6e8f662f3e1b119c5f832bfb6035e2e9d (patch) | |
tree | 2de27bafe0491fc83da0386d1cb672c0068fbd55 /remoting/host | |
parent | 1d1b6edb9404bbd8586965b141e799143f6efabb (diff) | |
download | chromium_src-b6e2d6a6e8f662f3e1b119c5f832bfb6035e2e9d.zip chromium_src-b6e2d6a6e8f662f3e1b119c5f832bfb6035e2e9d.tar.gz chromium_src-b6e2d6a6e8f662f3e1b119c5f832bfb6035e2e9d.tar.bz2 |
Remove JingleClient.
Everything that JingleClient was doing has been rolled into JingleSessionManager
BUG=None
TEST=Remoting still works.
Review URL: http://codereview.chromium.org/7277050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/chromoting_host.cc | 66 | ||||
-rw-r--r-- | remoting/host/chromoting_host.h | 21 | ||||
-rw-r--r-- | remoting/host/heartbeat_sender.cc | 2 | ||||
-rw-r--r-- | remoting/host/heartbeat_sender_unittest.cc | 1 | ||||
-rw-r--r-- | remoting/host/register_support_host_request.cc | 2 | ||||
-rw-r--r-- | remoting/host/register_support_host_request_unittest.cc | 1 |
6 files changed, 39 insertions, 54 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 19d87b1..f38e928 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -85,13 +85,13 @@ ChromotingHost::~ChromotingHost() { } void ChromotingHost::Start() { - if (MessageLoop::current() != context_->main_message_loop()) { - context_->main_message_loop()->PostTask( + if (MessageLoop::current() != context_->network_message_loop()) { + context_->network_message_loop()->PostTask( FROM_HERE, base::Bind(&ChromotingHost::Start, this)); return; } - DCHECK(!jingle_client_); + DCHECK(!signal_strategy_.get()); DCHECK(access_verifier_.get()); // Make sure this object is not started. @@ -117,10 +117,7 @@ void ChromotingHost::Start() { new XmppSignalStrategy(context_->jingle_thread(), xmpp_login, xmpp_auth_token, xmpp_auth_service)); - jingle_client_ = new JingleClient(context_->network_message_loop(), - signal_strategy_.get(), - NULL, NULL, NULL, this); - jingle_client_->Init(); + signal_strategy_->Init(this); } // This method is called when we need to destroy the host process. @@ -165,10 +162,10 @@ void ChromotingHost::Shutdown(Task* shutdown_task) { // Stop chromotocol session manager. if (session_manager_) { session_manager_->Close( - NewRunnableMethod(this, &ChromotingHost::ShutdownJingleClient)); + NewRunnableMethod(this, &ChromotingHost::ShutdownSignaling)); session_manager_ = NULL; } else { - ShutdownJingleClient(); + ShutdownSignaling(); } } @@ -224,19 +221,17 @@ void ChromotingHost::OnSequenceNumberUpdated(ConnectionToClient* connection, //////////////////////////////////////////////////////////////////////////// // JingleClient::Callback implementations -void ChromotingHost::OnStateChange(JingleClient* jingle_client, - JingleClient::State state) { +void ChromotingHost::OnStateChange( + SignalStrategy::StatusObserver::State state) { DCHECK_EQ(MessageLoop::current(), context_->network_message_loop()); - if (state == JingleClient::CONNECTED) { - std::string jid = jingle_client->GetFullJid(); - - DCHECK_EQ(jingle_client_.get(), jingle_client); - VLOG(1) << "Host connected as " << jid; + if (state == SignalStrategy::StatusObserver::CONNECTED) { + VLOG(1) << "Host connected as " << local_jid_; // Create and start session manager. protocol::JingleSessionManager* server = - new protocol::JingleSessionManager(context_->network_message_loop()); + new protocol::JingleSessionManager(context_->network_message_loop(), + NULL, NULL, NULL); // TODO(ajwong): Make this a command switch when we're more stable. server->set_allow_local_ips(true); @@ -245,7 +240,7 @@ void ChromotingHost::OnStateChange(JingleClient* jingle_client, CHECK(key_pair.Load(config_)) << "Failed to load server authentication data"; - server->Init(jid, jingle_client->session_manager(), + server->Init(local_jid_, signal_strategy_.get(), NewCallback(this, &ChromotingHost::OnNewClientSession), key_pair.CopyPrivateKey(), key_pair.GenerateCertificate()); @@ -253,9 +248,9 @@ void ChromotingHost::OnStateChange(JingleClient* jingle_client, for (StatusObserverList::iterator it = status_observers_.begin(); it != status_observers_.end(); ++it) { - (*it)->OnSignallingConnected(signal_strategy_.get(), jid); + (*it)->OnSignallingConnected(signal_strategy_.get(), local_jid_); } - } else if (state == JingleClient::CLOSED) { + } else if (state == SignalStrategy::StatusObserver::CLOSED) { VLOG(1) << "Host disconnected from talk network."; for (StatusObserverList::iterator it = status_observers_.begin(); it != status_observers_.end(); ++it) { @@ -268,6 +263,11 @@ void ChromotingHost::OnStateChange(JingleClient* jingle_client, } } +void ChromotingHost::OnJidChange(const std::string& full_jid) { + DCHECK_EQ(MessageLoop::current(), context_->network_message_loop()); + local_jid_ = full_jid; +} + void ChromotingHost::OnNewClientSession( protocol::Session* session, protocol::SessionManager::IncomingSessionResponse* response) { @@ -630,30 +630,18 @@ void ChromotingHost::ContinueWindowTimerFunc() { ShowContinueWindow(true); } -void ChromotingHost::ShutdownJingleClient() { - if (MessageLoop::current() != context_->main_message_loop()) { - context_->main_message_loop()->PostTask( - FROM_HERE, base::Bind(&ChromotingHost::ShutdownJingleClient, this)); - return; - } - - // Disconnect from the talk network. - if (jingle_client_) { - jingle_client_->Close(base::Bind( - &ChromotingHost::ShutdownSignallingDisconnected, this)); - } else { - ShutdownRecorder(); - } -} - -void ChromotingHost::ShutdownSignallingDisconnected() { +void ChromotingHost::ShutdownSignaling() { if (MessageLoop::current() != context_->network_message_loop()) { context_->network_message_loop()->PostTask( - FROM_HERE, base::Bind( - &ChromotingHost::ShutdownSignallingDisconnected, this)); + FROM_HERE, base::Bind(&ChromotingHost::ShutdownSignaling, this)); return; } + if (signal_strategy_.get()) { + signal_strategy_->Close(); + signal_strategy_.reset(); + } + for (StatusObserverList::iterator it = status_observers_.begin(); it != status_observers_.end(); ++it) { (*it)->OnSignallingDisconnected(); diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h index 6f969d4..760d895 100644 --- a/remoting/host/chromoting_host.h +++ b/remoting/host/chromoting_host.h @@ -16,8 +16,8 @@ #include "remoting/host/client_session.h" #include "remoting/host/desktop_environment.h" #include "remoting/host/host_status_observer.h" -#include "remoting/jingle_glue/jingle_client.h" #include "remoting/jingle_glue/jingle_thread.h" +#include "remoting/jingle_glue/signal_strategy.h" #include "remoting/protocol/session_manager.h" #include "remoting/protocol/connection_to_client.h" @@ -66,7 +66,7 @@ class ScreenRecorder; class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, public protocol::ConnectionToClient::EventHandler, public ClientSession::EventHandler, - public JingleClient::Callback { + public SignalStrategy::StatusObserver { public: // Factory methods that must be used to create ChromotingHost instances. // Default capturer and input stub are used if it is not specified. @@ -99,7 +99,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, void AddStatusObserver(HostStatusObserver* observer); //////////////////////////////////////////////////////////////////////////// - // protocol::ConnectionToClient::EventHandler implementations + // protocol::ConnectionToClient::EventHandler implementation. virtual void OnConnectionOpened(protocol::ConnectionToClient* client); virtual void OnConnectionClosed(protocol::ConnectionToClient* client); virtual void OnConnectionFailed(protocol::ConnectionToClient* client); @@ -107,11 +107,13 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, int64 sequence_number); //////////////////////////////////////////////////////////////////////////// - // JingleClient::Callback implementations - virtual void OnStateChange(JingleClient* client, JingleClient::State state); + // SignalStrategy implementation. + virtual void OnStateChange( + SignalStrategy::StatusObserver::State state) OVERRIDE; + virtual void OnJidChange(const std::string& full_jid) OVERRIDE; //////////////////////////////////////////////////////////////////////////// - // ClientSession::EventHandler implementations + // ClientSession::EventHandler implementation. virtual void LocalLoginSucceeded( scoped_refptr<protocol::ConnectionToClient> client); virtual void LocalLoginFailed( @@ -190,8 +192,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, void ContinueWindowTimerFunc(); // The following methods are called during shutdown. - void ShutdownJingleClient(); - void ShutdownSignallingDisconnected(); + void ShutdownSignaling(); void ShutdownRecorder(); void ShutdownFinish(); @@ -204,9 +205,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, scoped_ptr<SignalStrategy> signal_strategy_; - // The libjingle client. This is used to connect to the talk network to - // receive connection requests from chromoting client. - scoped_refptr<JingleClient> jingle_client_; + std::string local_jid_; scoped_refptr<protocol::SessionManager> session_manager_; diff --git a/remoting/host/heartbeat_sender.cc b/remoting/host/heartbeat_sender.cc index da552c5..ad87658 100644 --- a/remoting/host/heartbeat_sender.cc +++ b/remoting/host/heartbeat_sender.cc @@ -11,8 +11,8 @@ #include "remoting/base/constants.h" #include "remoting/host/host_config.h" #include "remoting/jingle_glue/iq_request.h" -#include "remoting/jingle_glue/jingle_client.h" #include "remoting/jingle_glue/jingle_thread.h" +#include "remoting/jingle_glue/signal_strategy.h" #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" #include "third_party/libjingle/source/talk/xmpp/constants.h" diff --git a/remoting/host/heartbeat_sender_unittest.cc b/remoting/host/heartbeat_sender_unittest.cc index 4ffa458..617bf03 100644 --- a/remoting/host/heartbeat_sender_unittest.cc +++ b/remoting/host/heartbeat_sender_unittest.cc @@ -12,7 +12,6 @@ #include "remoting/host/in_memory_host_config.h" #include "remoting/host/test_key_pair.h" #include "remoting/jingle_glue/iq_request.h" -#include "remoting/jingle_glue/jingle_client.h" #include "remoting/jingle_glue/mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/remoting/host/register_support_host_request.cc b/remoting/host/register_support_host_request.cc index 0e716dc..bd16b6b 100644 --- a/remoting/host/register_support_host_request.cc +++ b/remoting/host/register_support_host_request.cc @@ -11,8 +11,8 @@ #include "remoting/base/constants.h" #include "remoting/host/host_config.h" #include "remoting/jingle_glue/iq_request.h" -#include "remoting/jingle_glue/jingle_client.h" #include "remoting/jingle_glue/jingle_thread.h" +#include "remoting/jingle_glue/signal_strategy.h" #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" #include "third_party/libjingle/source/talk/xmpp/constants.h" diff --git a/remoting/host/register_support_host_request_unittest.cc b/remoting/host/register_support_host_request_unittest.cc index 58c639e..c290581 100644 --- a/remoting/host/register_support_host_request_unittest.cc +++ b/remoting/host/register_support_host_request_unittest.cc @@ -13,7 +13,6 @@ #include "remoting/host/in_memory_host_config.h" #include "remoting/host/test_key_pair.h" #include "remoting/jingle_glue/iq_request.h" -#include "remoting/jingle_glue/jingle_client.h" #include "remoting/jingle_glue/mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" |