summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 22:48:55 +0000
committersimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 22:48:55 +0000
commit00c794adf30fcc7d84f60a0f23d1e69e063410f3 (patch)
tree5ce19b67228e6460635a7fa0ce3f8d376e939728 /remoting
parenta9d504a910a42f7dd3f84aaa504cce5ecbfc3015 (diff)
downloadchromium_src-00c794adf30fcc7d84f60a0f23d1e69e063410f3.zip
chromium_src-00c794adf30fcc7d84f60a0f23d1e69e063410f3.tar.gz
chromium_src-00c794adf30fcc7d84f60a0f23d1e69e063410f3.tar.bz2
The host sends simple log entries to the server.
BUG= TEST= Review URL: http://codereview.chromium.org/8468015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/log_to_server.cc97
-rw-r--r--remoting/host/log_to_server.h63
-rw-r--r--remoting/host/log_to_server_unittest.cc93
-rw-r--r--remoting/host/plugin/host_script_object.cc7
-rw-r--r--remoting/host/plugin/host_script_object.h7
-rw-r--r--remoting/host/server_log_entry.cc103
-rw-r--r--remoting/host/server_log_entry.h45
-rw-r--r--remoting/host/server_log_entry_unittest.cc105
-rw-r--r--remoting/host/simple_host_process.cc5
-rw-r--r--remoting/remoting.gyp8
10 files changed, 530 insertions, 3 deletions
diff --git a/remoting/host/log_to_server.cc b/remoting/host/log_to_server.cc
new file mode 100644
index 0000000..0dc3618
--- /dev/null
+++ b/remoting/host/log_to_server.cc
@@ -0,0 +1,97 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/log_to_server.h"
+
+#include "base/bind.h"
+#include "base/message_loop_proxy.h"
+#include "remoting/base/constants.h"
+#include "remoting/host/server_log_entry.h"
+#include "remoting/jingle_glue/iq_sender.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"
+
+using buzz::QName;
+using buzz::XmlElement;
+
+namespace remoting {
+
+namespace {
+const char kLogCommand[] = "log";
+} // namespace
+
+LogToServer::LogToServer(base::MessageLoopProxy* message_loop)
+ : message_loop_(message_loop) {
+}
+
+LogToServer::~LogToServer() {
+}
+
+void LogToServer::LogSessionStateChange(bool connected) {
+ scoped_ptr<ServerLogEntry> entry(ServerLogEntry::MakeSessionStateChange(
+ connected));
+ entry->AddHostFields();
+ Log(*entry.get());
+}
+
+void LogToServer::OnSignallingConnected(SignalStrategy* signal_strategy,
+ const std::string& full_jid) {
+ DCHECK(message_loop_->BelongsToCurrentThread());
+ iq_sender_.reset(new IqSender(signal_strategy));
+ SendPendingEntries();
+}
+
+void LogToServer::OnSignallingDisconnected() {
+ DCHECK(message_loop_->BelongsToCurrentThread());
+ iq_sender_.reset();
+}
+
+void LogToServer::OnAccessDenied() {
+}
+
+void LogToServer::OnClientAuthenticated(const std::string& jid) {
+ LogSessionStateChange(true);
+}
+
+void LogToServer::OnClientDisconnected(const std::string& jid) {
+ LogSessionStateChange(false);
+}
+
+void LogToServer::OnShutdown() {
+}
+
+void LogToServer::Log(const ServerLogEntry& entry) {
+ DCHECK(message_loop_->BelongsToCurrentThread());
+ pending_entries_.push_back(entry);
+ SendPendingEntries();
+}
+
+void LogToServer::SendPendingEntries() {
+ DCHECK(message_loop_->BelongsToCurrentThread());
+
+ if (iq_sender_ == NULL) {
+ return;
+ }
+ if (pending_entries_.empty()) {
+ return;
+ }
+ // Make one stanza containing all the pending entries.
+ scoped_ptr<XmlElement> stanza(new XmlElement(QName(
+ kChromotingXmlNamespace, kLogCommand)));
+ while (!pending_entries_.empty()) {
+ ServerLogEntry& entry = pending_entries_.front();
+ stanza->AddElement(entry.ToStanza());
+ pending_entries_.pop_front();
+ }
+ // Send the stanza to the server.
+ scoped_ptr<IqRequest> req(iq_sender_->SendIq(
+ buzz::STR_SET, kChromotingBotJid, stanza.release(),
+ IqSender::ReplyCallback()));
+ // We ignore any response, so let the IqRequest be destroyed.
+ return;
+}
+
+} // namespace remoting
diff --git a/remoting/host/log_to_server.h b/remoting/host/log_to_server.h
new file mode 100644
index 0000000..b7b17d5
--- /dev/null
+++ b/remoting/host/log_to_server.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_LOG_TO_SERVER_H_
+#define REMOTING_HOST_LOG_TO_SERVER_H_
+
+#include <deque>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "remoting/host/host_status_observer.h"
+#include "remoting/host/server_log_entry.h"
+
+namespace base {
+class MessageLoopProxy;
+} // namespace base
+
+namespace buzz {
+class XmlElement;
+} // namespace buzz
+
+namespace remoting {
+
+class IqSender;
+
+/**
+ * A class that sends log entries to a server.
+ *
+ * The class is not thread-safe.
+ */
+class LogToServer : public HostStatusObserver {
+ public:
+ explicit LogToServer(base::MessageLoopProxy* message_loop);
+ virtual ~LogToServer();
+
+ // Logs a session state change.
+ // Currently, this is either connection or disconnection.
+ void LogSessionStateChange(bool connected);
+
+ // HostStatusObserver implementation.
+ virtual void OnSignallingConnected(SignalStrategy* signal_strategy,
+ const std::string& full_jid) OVERRIDE;
+ virtual void OnSignallingDisconnected() OVERRIDE;
+ virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE;
+ virtual void OnClientDisconnected(const std::string& jid) OVERRIDE;
+ virtual void OnAccessDenied() OVERRIDE;
+ virtual void OnShutdown() OVERRIDE;
+
+ private:
+ void Log(const ServerLogEntry& entry);
+ void SendPendingEntries();
+
+ scoped_refptr<base::MessageLoopProxy> message_loop_;
+ scoped_ptr<IqSender> iq_sender_;
+ std::deque<ServerLogEntry> pending_entries_;
+
+ DISALLOW_COPY_AND_ASSIGN(LogToServer);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_LOG_TO_SERVER_H_
diff --git a/remoting/host/log_to_server_unittest.cc b/remoting/host/log_to_server_unittest.cc
new file mode 100644
index 0000000..768abc4
--- /dev/null
+++ b/remoting/host/log_to_server_unittest.cc
@@ -0,0 +1,93 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
+#include "remoting/jingle_glue/mock_objects.h"
+#include "remoting/host/log_to_server.h"
+#include "testing/gmock_mutant.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using testing::_;
+using testing::InSequence;
+
+namespace remoting {
+
+namespace {
+
+ACTION_P(QuitMainMessageLoop, message_loop) {
+ message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask());
+}
+
+} // namespace
+
+class LogToServerTest : public testing::Test {
+ public:
+ LogToServerTest() {}
+ virtual void SetUp() OVERRIDE {
+ message_loop_proxy_ = base::MessageLoopProxy::current();
+ log_to_server_.reset(new LogToServer(message_loop_proxy_));
+ }
+
+ protected:
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+ scoped_ptr<LogToServer> log_to_server_;
+ MessageLoop message_loop_;
+ MockSignalStrategy signal_strategy_;
+};
+
+TEST_F(LogToServerTest, SendNow) {
+ {
+ InSequence s;
+ EXPECT_CALL(signal_strategy_, AddListener(_));
+ EXPECT_CALL(signal_strategy_, GetNextId());
+ EXPECT_CALL(signal_strategy_, SendStanza(_));
+ EXPECT_CALL(signal_strategy_, RemoveListener(_))
+ .WillOnce(QuitMainMessageLoop(&message_loop_))
+ .RetiresOnSaturation();
+ }
+ log_to_server_->OnSignallingConnected(&signal_strategy_,
+ "host@domain.com/1234");
+ log_to_server_->OnClientAuthenticated("client@domain.com/5678");
+ log_to_server_->OnSignallingDisconnected();
+ message_loop_.Run();
+}
+
+TEST_F(LogToServerTest, SendLater) {
+ {
+ InSequence s;
+ EXPECT_CALL(signal_strategy_, AddListener(_));
+ EXPECT_CALL(signal_strategy_, GetNextId());
+ EXPECT_CALL(signal_strategy_, SendStanza(_));
+ EXPECT_CALL(signal_strategy_, RemoveListener(_))
+ .WillOnce(QuitMainMessageLoop(&message_loop_))
+ .RetiresOnSaturation();
+ }
+ log_to_server_->OnClientAuthenticated("client@domain.com/5678");
+ log_to_server_->OnSignallingConnected(&signal_strategy_,
+ "host@domain.com/1234");
+ log_to_server_->OnSignallingDisconnected();
+ message_loop_.Run();
+}
+
+TEST_F(LogToServerTest, SendTwoEntriesLater) {
+ {
+ InSequence s;
+ EXPECT_CALL(signal_strategy_, AddListener(_));
+ EXPECT_CALL(signal_strategy_, GetNextId());
+ EXPECT_CALL(signal_strategy_, SendStanza(_));
+ EXPECT_CALL(signal_strategy_, RemoveListener(_))
+ .WillOnce(QuitMainMessageLoop(&message_loop_))
+ .RetiresOnSaturation();
+ }
+ log_to_server_->OnClientAuthenticated("client@domain.com/5678");
+ log_to_server_->OnClientAuthenticated("client2@domain.com/6789");
+ log_to_server_->OnSignallingConnected(&signal_strategy_,
+ "host@domain.com/1234");
+ log_to_server_->OnSignallingDisconnected();
+ message_loop_.Run();
+}
+
+} // namespace remoting
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 7a23ecc..779aae3 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -92,7 +92,8 @@ HostNPScriptObject::HostNPScriptObject(
disconnected_event_(true, false),
am_currently_logging_(false),
nat_traversal_enabled_(false),
- policy_received_(false) {
+ policy_received_(false),
+ enable_log_to_server_(false) {
}
HostNPScriptObject::~HostNPScriptObject() {
@@ -519,6 +520,10 @@ void HostNPScriptObject::FinishConnect(
access_verifier.release(), nat_traversal_enabled_);
host_->AddStatusObserver(this);
host_->AddStatusObserver(register_request_.get());
+ if (enable_log_to_server_) {
+ log_to_server_.reset(new LogToServer(host_context_.network_message_loop()));
+ host_->AddStatusObserver(log_to_server_.get());
+ }
host_->set_it2me(true);
{
diff --git a/remoting/host/plugin/host_script_object.h b/remoting/host/plugin/host_script_object.h
index 3769cb9..d52ce71 100644
--- a/remoting/host/plugin/host_script_object.h
+++ b/remoting/host/plugin/host_script_object.h
@@ -20,6 +20,7 @@
#include "remoting/base/plugin_message_loop_proxy.h"
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/host_status_observer.h"
+#include "remoting/host/log_to_server.h"
#include "remoting/host/plugin/host_plugin_utils.h"
#include "remoting/host/ui_strings.h"
#include "third_party/npapi/bindings/npapi.h"
@@ -177,6 +178,7 @@ class HostNPScriptObject : public HostStatusObserver {
scoped_refptr<PluginMessageLoopProxy> plugin_message_loop_proxy_;
scoped_ptr<RegisterSupportHostRequest> register_request_;
+ scoped_ptr<LogToServer> log_to_server_;
scoped_refptr<MutableHostConfig> host_config_;
ChromotingHostContext host_context_;
scoped_ptr<DesktopEnvironment> desktop_environment_;
@@ -199,11 +201,14 @@ class HostNPScriptObject : public HostStatusObserver {
// Host the current nat traversal policy setting.
bool nat_traversal_enabled_;
- // Indiciates whether or not a policy has ever been read. This is to ensure
+ // Indicates whether or not a policy has ever been read. This is to ensure
// that on startup, we do not accidentally start a connection before we have
// queried our policy restrictions.
bool policy_received_;
+ // Whether logging to a server is enabled.
+ bool enable_log_to_server_;
+
// On startup, it is possible to have Connect() called before the policy read
// is completed. Rather than just failing, we thunk the connection call so
// it can be executed after at least one successful policy read. This
diff --git a/remoting/host/server_log_entry.cc b/remoting/host/server_log_entry.cc
new file mode 100644
index 0000000..08e649d
--- /dev/null
+++ b/remoting/host/server_log_entry.cc
@@ -0,0 +1,103 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/server_log_entry.h"
+
+#include "base/sys_info.h"
+#include "remoting/base/constants.h"
+#include "remoting/protocol/session.h"
+#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
+
+using base::SysInfo;
+using buzz::QName;
+using buzz::XmlElement;
+using remoting::protocol::Session;
+
+namespace remoting {
+
+namespace {
+const char kLogEntry[] = "entry";
+
+const char kKeyEventName[] = "event-name";
+const char kValueEventNameSessionState[] = "session-state";
+
+const char kKeyRole[] = "role";
+const char kValueRoleHost[] = "host";
+
+const char kKeySessionState[] = "session-state";
+const char kValueSessionStateConnected[] = "connected";
+const char kValueSessionStateClosed[] = "closed";
+
+const char kKeyOsName[] = "os-name";
+const char kValueOsNameWindows[] = "Windows";
+const char kValueOsNameLinux[] = "Linux";
+const char kValueOsNameMac[] = "Mac";
+const char kValueOsNameChromeOS[] = "ChromeOS";
+
+const char kKeyOsVersion[] = "os-version";
+
+const char kKeyCpu[] = "cpu";
+} // namespace
+
+ServerLogEntry::ServerLogEntry() {
+}
+
+ServerLogEntry::~ServerLogEntry() {
+}
+
+ServerLogEntry* ServerLogEntry::MakeSessionStateChange(bool connected) {
+ ServerLogEntry* entry = new ServerLogEntry();
+ entry->Set(kKeyRole, kValueRoleHost);
+ entry->Set(kKeyEventName, kValueEventNameSessionState);
+ entry->Set(kKeySessionState, GetValueSessionState(connected));
+ return entry;
+}
+
+void ServerLogEntry::AddHostFields() {
+#if defined(OS_WIN)
+ Set(kKeyOsName, kValueOsNameWindows);
+#elif defined(OS_MACOSX)
+ Set(kKeyOsName, kValueOsNameMac);
+#elif defined(OS_CHROMEOS)
+ Set(kKeyOsName, kValueOsNameChromeOS);
+#elif defined(OS_LINUX)
+ Set(kKeyOsName, kValueOsNameLinux);
+#endif
+
+ // SysInfo::OperatingSystemVersionNumbers is only defined for the following
+ // OSes: see base/sys_info_unittest.cc.
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
+ std::stringstream os_version;
+ int32 os_major_version = 0;
+ int32 os_minor_version = 0;
+ int32 os_bugfix_version = 0;
+ SysInfo::OperatingSystemVersionNumbers(&os_major_version, &os_minor_version,
+ &os_bugfix_version);
+ os_version << os_major_version << "." << os_minor_version << "."
+ << os_bugfix_version;
+ Set(kKeyOsVersion, os_version.str().c_str());
+#endif
+
+ Set(kKeyCpu, SysInfo::CPUArchitecture().c_str());
+};
+
+XmlElement* ServerLogEntry::ToStanza() const {
+ XmlElement* stanza = new XmlElement(QName(
+ kChromotingXmlNamespace, kLogEntry));
+ ValuesMap::const_iterator iter;
+ for (iter = values_map_.begin(); iter != values_map_.end(); ++iter) {
+ stanza->AddAttr(QName("", iter->first), iter->second);
+ }
+ return stanza;
+}
+
+const char* ServerLogEntry::GetValueSessionState(bool connected) {
+ return connected ? kValueSessionStateConnected : kValueSessionStateClosed;
+}
+
+void ServerLogEntry::Set(const char* key, const char* value) {
+ values_map_[key] = value;
+}
+
+} // namespace remoting
diff --git a/remoting/host/server_log_entry.h b/remoting/host/server_log_entry.h
new file mode 100644
index 0000000..1b1d452
--- /dev/null
+++ b/remoting/host/server_log_entry.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_SERVER_LOG_ENTRY_H_
+#define REMOTING_HOST_SERVER_LOG_ENTRY_H_
+
+#include <map>
+#include <string>
+
+namespace buzz {
+class XmlElement;
+} // namespace buzz
+
+namespace remoting {
+
+class ServerLogEntry {
+ public:
+ // Constructs a log entry for a session state change.
+ // Currently this is either connection or disconnection.
+ static ServerLogEntry* MakeSessionStateChange(bool connection);
+
+ ~ServerLogEntry();
+
+ // Adds fields describing the host to this log entry.
+ void AddHostFields();
+
+ // Converts this object to an XML stanza.
+ // The caller takes ownership of the stanza.
+ buzz::XmlElement* ToStanza() const;
+
+ private:
+ typedef std::map<std::string, std::string> ValuesMap;
+
+ ServerLogEntry();
+ void Set(const char* key, const char* value);
+
+ static const char* GetValueSessionState(bool connected);
+
+ ValuesMap values_map_;
+};
+
+} // namespace remoting
+
+#endif
diff --git a/remoting/host/server_log_entry_unittest.cc b/remoting/host/server_log_entry_unittest.cc
new file mode 100644
index 0000000..11bf863
--- /dev/null
+++ b/remoting/host/server_log_entry_unittest.cc
@@ -0,0 +1,105 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/memory/scoped_ptr.h"
+#include "remoting/host/server_log_entry.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
+
+using buzz::XmlAttr;
+using buzz::XmlElement;
+
+namespace remoting {
+
+class ServerLogEntryTest : public testing::Test {
+ protected:
+ // Verifies a logging stanza.
+ // |keyValuePairs| lists the keys that must have specified values, and |keys|
+ // lists the keys that must be present, but may have arbitrary values.
+ // There must be no other keys.
+ static bool VerifyStanza(
+ const std::map<std::string, std::string>& key_value_pairs,
+ const std::set<std::string> keys,
+ const XmlElement* elem,
+ std::string* error) {
+ int attrCount = 0;
+ for (const XmlAttr* attr = elem->FirstAttr(); attr != NULL;
+ attr = attr->NextAttr(), attrCount++) {
+ if (attr->Name().Namespace().length() != 0) {
+ *error = "attribute has non-empty namespace " +
+ attr->Name().Namespace();
+ return false;
+ }
+ const std::string& key = attr->Name().LocalPart();
+ const std::string& value = attr->Value();
+ std::map<std::string, std::string>::const_iterator iter =
+ key_value_pairs.find(key);
+ if (iter == key_value_pairs.end()) {
+ if (keys.find(key) == keys.end()) {
+ *error = "unexpected attribute " + key;
+ return false;
+ }
+ } else {
+ if (iter->second != value) {
+ *error = "attribute " + key + " has value " + iter->second +
+ ": expected " + value;
+ return false;
+ }
+ }
+ }
+ int attr_count_expected = key_value_pairs.size() + keys.size();
+ if (attrCount != attr_count_expected) {
+ std::stringstream s;
+ s << "stanza has " << attrCount << " keys: expected "
+ << attr_count_expected;
+ *error = s.str();
+ return false;
+ }
+ return true;
+ }
+};
+
+TEST_F(ServerLogEntryTest, MakeSessionStateChange) {
+ scoped_ptr<ServerLogEntry> entry(
+ ServerLogEntry::MakeSessionStateChange(true));
+ scoped_ptr<XmlElement> stanza(entry->ToStanza());
+ std::string error;
+ std::map<std::string, std::string> key_value_pairs;
+ key_value_pairs["role"] = "host";
+ key_value_pairs["event-name"] = "session-state";
+ key_value_pairs["session-state"] = "connected";
+ std::set<std::string> keys;
+ ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) <<
+ error;
+}
+
+TEST_F(ServerLogEntryTest, AddHostFields) {
+ scoped_ptr<ServerLogEntry> entry(
+ ServerLogEntry::MakeSessionStateChange(true));
+ entry->AddHostFields();
+ scoped_ptr<XmlElement> stanza(entry->ToStanza());
+ std::string error;
+ std::map<std::string, std::string> key_value_pairs;
+ key_value_pairs["role"] = "host";
+ key_value_pairs["event-name"] = "session-state";
+ key_value_pairs["session-state"] = "connected";
+ std::set<std::string> keys;
+ keys.insert("cpu");
+#if defined(OS_WIN)
+ key_value_pairs["os-name"] = "Windows";
+ keys.insert("os-version");
+#elif defined(OS_MACOSX)
+ key_value_pairs["os-name"] = "Mac";
+ keys.insert("os-version");
+#elif defined(OS_CHROMEOS)
+ key_value_pairs["os-name"] = "ChromeOS";
+ keys.insert("os-version");
+#elif defined(OS_LINUX)
+ key_value_pairs["os-name"] = "Linux";
+#endif
+ ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) <<
+ error;
+}
+
+} // namespace remoting
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index 533a94c..99af071 100644
--- a/remoting/host/simple_host_process.cc
+++ b/remoting/host/simple_host_process.cc
@@ -42,6 +42,7 @@
#include "remoting/host/event_executor.h"
#include "remoting/host/heartbeat_sender.h"
#include "remoting/host/local_input_monitor.h"
+#include "remoting/host/log_to_server.h"
#include "remoting/host/json_host_config.h"
#include "remoting/host/register_support_host_request.h"
#include "remoting/host/self_access_verifier.h"
@@ -135,6 +136,7 @@ class SimpleHost {
scoped_ptr<remoting::AccessVerifier> access_verifier;
scoped_ptr<remoting::RegisterSupportHostRequest> register_request;
scoped_ptr<remoting::HeartbeatSender> heartbeat_sender;
+ scoped_ptr<remoting::LogToServer> log_to_server;
if (is_it2me_) {
scoped_ptr<remoting::SupportAccessVerifier> support_access_verifier(
new remoting::SupportAccessVerifier());
@@ -153,6 +155,8 @@ class SimpleHost {
return 1;
access_verifier.reset(self_access_verifier.release());
}
+ log_to_server.reset(new remoting::LogToServer(
+ context.network_message_loop()));
// Construct a chromoting host.
scoped_ptr<DesktopEnvironment> desktop_environment;
@@ -196,6 +200,7 @@ class SimpleHost {
return 1;
host_->AddStatusObserver(heartbeat_sender.get());
}
+ host_->AddStatusObserver(log_to_server.get());
// Let the chromoting host run until the shutdown task is executed.
host_->Start();
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index 4ed475b..9113cae 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -552,12 +552,16 @@
'host/local_input_monitor_thread_win.cc',
'host/local_input_monitor_thread_win.h',
'host/local_input_monitor_win.cc',
+ 'host/log_to_server.cc',
+ 'host/log_to_server.h',
'host/register_support_host_request.cc',
'host/register_support_host_request.h',
'host/self_access_verifier.cc',
'host/self_access_verifier.h',
'host/screen_recorder.cc',
'host/screen_recorder.h',
+ 'host/server_log_entry.cc',
+ 'host/server_log_entry.h',
'host/support_access_verifier.cc',
'host/support_access_verifier.h',
'host/ui_strings.cc',
@@ -902,9 +906,11 @@
'host/host_mock_objects.cc',
'host/host_mock_objects.h',
'host/json_host_config_unittest.cc',
+ 'host/log_to_server_unittest.cc',
'host/register_support_host_request_unittest.cc',
- 'host/self_access_verifier_unittest.cc',
'host/screen_recorder_unittest.cc',
+ 'host/self_access_verifier_unittest.cc',
+ 'host/server_log_entry_unittest.cc',
'host/test_key_pair.h',
'jingle_glue/fake_signal_strategy.cc',
'jingle_glue/fake_signal_strategy.h',