OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/host_event_logger.h" | 5 #include "remoting/host/host_event_logger.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // HostStatusObserver implementation. These methods will be called from the | 32 // HostStatusObserver implementation. These methods will be called from the |
33 // network thread. | 33 // network thread. |
34 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 34 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
35 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 35 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
36 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; | 36 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; |
37 virtual void OnClientRouteChange( | 37 virtual void OnClientRouteChange( |
38 const std::string& jid, | 38 const std::string& jid, |
39 const std::string& channel_name, | 39 const std::string& channel_name, |
40 const protocol::TransportRoute& route) OVERRIDE; | 40 const protocol::TransportRoute& route) OVERRIDE; |
| 41 virtual void OnStart(const std::string& xmpp_login) OVERRIDE; |
41 virtual void OnShutdown() OVERRIDE; | 42 virtual void OnShutdown() OVERRIDE; |
42 | 43 |
43 private: | 44 private: |
44 void LogString(WORD type, DWORD event_id, const std::string& string); | 45 void LogString(WORD type, DWORD event_id, const std::string& string); |
45 void Log(WORD type, DWORD event_id, const std::vector<std::string>& strings); | 46 void Log(WORD type, DWORD event_id, const std::vector<std::string>& strings); |
46 | 47 |
47 scoped_refptr<ChromotingHost> host_; | 48 scoped_refptr<ChromotingHost> host_; |
48 | 49 |
49 // The handle of the application event log. | 50 // The handle of the application event log. |
50 HANDLE event_log_; | 51 HANDLE event_log_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 std::vector<std::string> strings(5); | 95 std::vector<std::string> strings(5); |
95 strings[0] = jid; | 96 strings[0] = jid; |
96 strings[1] = route.remote_address.ToString(); | 97 strings[1] = route.remote_address.ToString(); |
97 strings[2] = route.local_address.ToString(); | 98 strings[2] = route.local_address.ToString(); |
98 strings[3] = channel_name; | 99 strings[3] = channel_name; |
99 strings[4] = protocol::TransportRoute::GetTypeString(route.type); | 100 strings[4] = protocol::TransportRoute::GetTypeString(route.type); |
100 Log(EVENTLOG_INFORMATION_TYPE, MSG_HOST_CLIENT_ROUTING_CHANGED, strings); | 101 Log(EVENTLOG_INFORMATION_TYPE, MSG_HOST_CLIENT_ROUTING_CHANGED, strings); |
101 } | 102 } |
102 | 103 |
103 void HostEventLoggerWin::OnShutdown() { | 104 void HostEventLoggerWin::OnShutdown() { |
| 105 // TODO(rmsousa): Fix host shutdown to actually call this, and add a log line. |
| 106 } |
| 107 |
| 108 void HostEventLoggerWin::OnStart(const std::string& xmpp_login) { |
| 109 LogString(EVENTLOG_INFORMATION_TYPE, MSG_HOST_STARTED, xmpp_login); |
104 } | 110 } |
105 | 111 |
106 void HostEventLoggerWin::Log(WORD type, | 112 void HostEventLoggerWin::Log(WORD type, |
107 DWORD event_id, | 113 DWORD event_id, |
108 const std::vector<std::string>& strings) { | 114 const std::vector<std::string>& strings) { |
109 if (event_log_ == NULL) | 115 if (event_log_ == NULL) |
110 return; | 116 return; |
111 | 117 |
112 // ReportEventW() takes an array of raw string pointers. They should stay | 118 // ReportEventW() takes an array of raw string pointers. They should stay |
113 // valid for the duration of the call. | 119 // valid for the duration of the call. |
(...skipping 26 matching lines...) Expand all Loading... |
140 } | 146 } |
141 | 147 |
142 // static | 148 // static |
143 scoped_ptr<HostEventLogger> HostEventLogger::Create( | 149 scoped_ptr<HostEventLogger> HostEventLogger::Create( |
144 ChromotingHost* host, const std::string& application_name) { | 150 ChromotingHost* host, const std::string& application_name) { |
145 return scoped_ptr<HostEventLogger>( | 151 return scoped_ptr<HostEventLogger>( |
146 new HostEventLoggerWin(host, application_name)); | 152 new HostEventLoggerWin(host, application_name)); |
147 } | 153 } |
148 | 154 |
149 } // namespace remoting | 155 } // namespace remoting |
OLD | NEW |