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 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
16 #include "remoting/host/host_status_monitor.h" | 16 #include "remoting/host/host_status_monitor.h" |
17 #include "remoting/host/host_status_observer.h" | 17 #include "remoting/host/host_status_observer.h" |
18 #include "remoting/host/remoting_host_messages.h" | 18 #include "remoting/host/remoting_host_messages.h" |
19 #include "remoting/protocol/transport.h" | 19 #include "remoting/protocol/transport.h" |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 class HostEventLoggerWin : public HostEventLogger, public HostStatusObserver { | 25 class HostEventLoggerWin : public HostEventLogger, public HostStatusObserver { |
26 public: | 26 public: |
27 HostEventLoggerWin(base::WeakPtr<HostStatusMonitor> monitor, | 27 HostEventLoggerWin(base::WeakPtr<HostStatusMonitor> monitor, |
28 const std::string& application_name); | 28 const std::string& application_name); |
29 | 29 |
30 virtual ~HostEventLoggerWin(); | 30 ~HostEventLoggerWin() override; |
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 void OnClientAuthenticated(const std::string& jid) override; |
35 virtual void OnClientDisconnected(const std::string& jid) override; | 35 void OnClientDisconnected(const std::string& jid) override; |
36 virtual void OnAccessDenied(const std::string& jid) override; | 36 void OnAccessDenied(const std::string& jid) override; |
37 virtual void OnClientRouteChange( | 37 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 void OnStart(const std::string& xmpp_login) override; |
42 virtual void OnShutdown() override; | 42 void OnShutdown() override; |
43 | 43 |
44 private: | 44 private: |
45 void LogString(WORD type, DWORD event_id, const std::string& string); | 45 void LogString(WORD type, DWORD event_id, const std::string& string); |
46 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); |
47 | 47 |
48 base::WeakPtr<HostStatusMonitor> monitor_; | 48 base::WeakPtr<HostStatusMonitor> monitor_; |
49 | 49 |
50 // The handle of the application event log. | 50 // The handle of the application event log. |
51 HANDLE event_log_; | 51 HANDLE event_log_; |
52 | 52 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 | 147 |
148 // static | 148 // static |
149 scoped_ptr<HostEventLogger> HostEventLogger::Create( | 149 scoped_ptr<HostEventLogger> HostEventLogger::Create( |
150 base::WeakPtr<HostStatusMonitor> monitor, | 150 base::WeakPtr<HostStatusMonitor> monitor, |
151 const std::string& application_name) { | 151 const std::string& application_name) { |
152 return make_scoped_ptr(new HostEventLoggerWin(monitor, application_name)); | 152 return make_scoped_ptr(new HostEventLoggerWin(monitor, application_name)); |
153 } | 153 } |
154 | 154 |
155 } // namespace remoting | 155 } // namespace remoting |
OLD | NEW |