summaryrefslogtreecommitdiffstats
path: root/remoting/host/chromoting_host.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 23:43:00 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 23:43:00 +0000
commit7620735be42ebc236d2da42d64f22dc5dedd01f9 (patch)
treebaf0e6311b84830cd76df764e73e9aacfeb65e3e /remoting/host/chromoting_host.cc
parentf90ab58c11abf783c850c632f9b0467f968e4045 (diff)
downloadchromium_src-7620735be42ebc236d2da42d64f22dc5dedd01f9.zip
chromium_src-7620735be42ebc236d2da42d64f22dc5dedd01f9.tar.gz
chromium_src-7620735be42ebc236d2da42d64f22dc5dedd01f9.tar.bz2
JSON based host config storage implemented. Python script for host registration.
BUG=None TEST=None Review URL: http://codereview.chromium.org/2804007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/chromoting_host.cc')
-rw-r--r--remoting/host/chromoting_host.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 9679442..0fc60e2 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -15,7 +15,7 @@
namespace remoting {
-ChromotingHost::ChromotingHost(HostConfig* config,
+ChromotingHost::ChromotingHost(MutableHostConfig* config,
Capturer* capturer,
Encoder* encoder,
EventExecutor* executor,
@@ -80,9 +80,17 @@ void ChromotingHost::RegisterHost() {
DCHECK_EQ(message_loop(), MessageLoop::current());
DCHECK(!jingle_client_);
+ std::string xmpp_login;
+ std::string xmpp_auth_token;
+ if (!config_->GetString(kXmppLoginConfigPath, &xmpp_login) ||
+ !config_->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token)) {
+ LOG(ERROR) << "XMMP credentials are not defined in config.";
+ return;
+ }
+
// Connect to the talk network with a JingleClient.
jingle_client_ = new JingleClient(&network_thread_);
- jingle_client_->Init(config_->xmpp_login(), config_->xmpp_auth_token(),
+ jingle_client_->Init(xmpp_login, xmpp_auth_token,
kChromotingTokenServiceName, this);
}
@@ -184,13 +192,14 @@ void ChromotingHost::OnStateChange(JingleClient* jingle_client,
// Start heartbeating after we connected
heartbeat_sender_ = new HeartbeatSender();
- // TODO(sergeyu): where do we get host id?
heartbeat_sender_->Start(config_, jingle_client_.get());
} else if (state == JingleClient::CLOSED) {
LOG(INFO) << "Host disconnected from talk network." << std::endl;
heartbeat_sender_ = NULL;
// Quit the message loop if disconected.
+ // TODO(sergeyu): We should try reconnecting here instead of terminating
+ // the host.
message_loop()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
host_done_->Signal();
}