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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
11 #include "remoting/host/host_status_monitor.h" | 11 #include "remoting/host/host_status_monitor.h" |
12 #include "remoting/host/host_status_observer.h" | 12 #include "remoting/host/host_status_observer.h" |
13 #include "remoting/protocol/transport.h" | 13 #include "remoting/protocol/transport.h" |
14 | 14 |
15 // Included here, since the #define for LOG_USER in syslog.h conflicts with the | 15 // Included here, since the #define for LOG_USER in syslog.h conflicts with the |
16 // constants in base/logging.h, and this source file should use the version in | 16 // constants in base/logging.h, and this source file should use the version in |
17 // syslog.h. | 17 // syslog.h. |
18 #include <syslog.h> | 18 #include <syslog.h> |
19 | 19 |
20 namespace remoting { | 20 namespace remoting { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 class HostEventLoggerPosix : public HostEventLogger, public HostStatusObserver { | 24 class HostEventLoggerPosix : public HostEventLogger, public HostStatusObserver { |
25 public: | 25 public: |
26 HostEventLoggerPosix(base::WeakPtr<HostStatusMonitor> monitor, | 26 HostEventLoggerPosix(base::WeakPtr<HostStatusMonitor> monitor, |
27 const std::string& application_name); | 27 const std::string& application_name); |
28 | 28 |
29 virtual ~HostEventLoggerPosix(); | 29 ~HostEventLoggerPosix() override; |
30 | 30 |
31 // HostStatusObserver implementation. These methods will be called from the | 31 // HostStatusObserver implementation. These methods will be called from the |
32 // network thread. | 32 // network thread. |
33 virtual void OnClientAuthenticated(const std::string& jid) override; | 33 void OnClientAuthenticated(const std::string& jid) override; |
34 virtual void OnClientDisconnected(const std::string& jid) override; | 34 void OnClientDisconnected(const std::string& jid) override; |
35 virtual void OnAccessDenied(const std::string& jid) override; | 35 void OnAccessDenied(const std::string& jid) override; |
36 virtual void OnClientRouteChange( | 36 void OnClientRouteChange(const std::string& jid, |
37 const std::string& jid, | 37 const std::string& channel_name, |
38 const std::string& channel_name, | 38 const protocol::TransportRoute& route) override; |
39 const protocol::TransportRoute& route) override; | 39 void OnStart(const std::string& xmpp_login) override; |
40 virtual void OnStart(const std::string& xmpp_login) override; | 40 void OnShutdown() override; |
41 virtual void OnShutdown() override; | |
42 | 41 |
43 private: | 42 private: |
44 void Log(const std::string& message); | 43 void Log(const std::string& message); |
45 | 44 |
46 base::WeakPtr<HostStatusMonitor> monitor_; | 45 base::WeakPtr<HostStatusMonitor> monitor_; |
47 std::string application_name_; | 46 std::string application_name_; |
48 | 47 |
49 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerPosix); | 48 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerPosix); |
50 }; | 49 }; |
51 | 50 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 102 } |
104 | 103 |
105 // static | 104 // static |
106 scoped_ptr<HostEventLogger> HostEventLogger::Create( | 105 scoped_ptr<HostEventLogger> HostEventLogger::Create( |
107 base::WeakPtr<HostStatusMonitor> monitor, | 106 base::WeakPtr<HostStatusMonitor> monitor, |
108 const std::string& application_name) { | 107 const std::string& application_name) { |
109 return make_scoped_ptr(new HostEventLoggerPosix(monitor, application_name)); | 108 return make_scoped_ptr(new HostEventLoggerPosix(monitor, application_name)); |
110 } | 109 } |
111 | 110 |
112 } // namespace remoting | 111 } // namespace remoting |
OLD | NEW |