Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 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 OnShutdown() OVERRIDE; | 41 virtual void OnShutdown() OVERRIDE; |
| 42 | 42 |
| 43 //HostEventLogger implementation. | |
|
alexeypa (please no reviews)
2012/08/29 15:15:48
nit: space in front of HostEventLogger
rmsousa
2012/08/29 19:24:40
Done.
| |
| 44 virtual void OnStart(const std::string& xmpp_login) OVERRIDE; | |
| 45 | |
| 43 private: | 46 private: |
| 44 void LogString(WORD type, DWORD event_id, const std::string& string); | 47 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); | 48 void Log(WORD type, DWORD event_id, const std::vector<std::string>& strings); |
| 46 | 49 |
| 47 scoped_refptr<ChromotingHost> host_; | 50 scoped_refptr<ChromotingHost> host_; |
| 48 | 51 |
| 49 // The handle of the application event log. | 52 // The handle of the application event log. |
| 50 HANDLE event_log_; | 53 HANDLE event_log_; |
| 51 | 54 |
| 52 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerWin); | 55 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerWin); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 strings[1] = route.remote_address.ToString(); | 99 strings[1] = route.remote_address.ToString(); |
| 97 strings[2] = route.local_address.ToString(); | 100 strings[2] = route.local_address.ToString(); |
| 98 strings[3] = channel_name; | 101 strings[3] = channel_name; |
| 99 strings[4] = protocol::TransportRoute::GetTypeString(route.type); | 102 strings[4] = protocol::TransportRoute::GetTypeString(route.type); |
| 100 Log(EVENTLOG_INFORMATION_TYPE, MSG_HOST_CLIENT_ROUTING_CHANGED, strings); | 103 Log(EVENTLOG_INFORMATION_TYPE, MSG_HOST_CLIENT_ROUTING_CHANGED, strings); |
| 101 } | 104 } |
| 102 | 105 |
| 103 void HostEventLoggerWin::OnShutdown() { | 106 void HostEventLoggerWin::OnShutdown() { |
| 104 } | 107 } |
| 105 | 108 |
| 109 void HostEventLoggerWin::OnStart(const std::string& xmpp_login) { | |
| 110 LogString(EVENTLOG_INFORMATION_TYPE, MSG_HOST_STARTED, xmpp_login); | |
| 111 } | |
| 112 | |
| 106 void HostEventLoggerWin::Log(WORD type, | 113 void HostEventLoggerWin::Log(WORD type, |
| 107 DWORD event_id, | 114 DWORD event_id, |
| 108 const std::vector<std::string>& strings) { | 115 const std::vector<std::string>& strings) { |
| 109 if (event_log_ == NULL) | 116 if (event_log_ == NULL) |
| 110 return; | 117 return; |
| 111 | 118 |
| 112 // ReportEventW() takes an array of raw string pointers. They should stay | 119 // ReportEventW() takes an array of raw string pointers. They should stay |
| 113 // valid for the duration of the call. | 120 // valid for the duration of the call. |
| 114 std::vector<const WCHAR*> raw_strings(strings.size()); | 121 std::vector<const WCHAR*> raw_strings(strings.size()); |
| 115 std::vector<string16> utf16_strings(strings.size()); | 122 std::vector<string16> utf16_strings(strings.size()); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 140 } | 147 } |
| 141 | 148 |
| 142 // static | 149 // static |
| 143 scoped_ptr<HostEventLogger> HostEventLogger::Create( | 150 scoped_ptr<HostEventLogger> HostEventLogger::Create( |
| 144 ChromotingHost* host, const std::string& application_name) { | 151 ChromotingHost* host, const std::string& application_name) { |
| 145 return scoped_ptr<HostEventLogger>( | 152 return scoped_ptr<HostEventLogger>( |
| 146 new HostEventLoggerWin(host, application_name)); | 153 new HostEventLoggerWin(host, application_name)); |
| 147 } | 154 } |
| 148 | 155 |
| 149 } // namespace remoting | 156 } // namespace remoting |
| OLD | NEW |