| 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 #ifndef REMOTING_HOST_HOST_EVENT_LOGGER_H_ | 5 #ifndef REMOTING_HOST_HOST_EVENT_LOGGER_H_ |
| 6 #define REMOTING_HOST_HOST_EVENT_LOGGER_H_ | 6 #define REMOTING_HOST_HOST_EVENT_LOGGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 14 #include "remoting/host/host_status_observer.h" | |
| 15 | 13 |
| 16 namespace remoting { | 14 namespace remoting { |
| 17 | 15 |
| 18 class ChromotingHost; | 16 class ChromotingHost; |
| 19 class SystemEventLogger; | |
| 20 | 17 |
| 21 class HostEventLogger : public HostStatusObserver { | 18 class HostEventLogger { |
| 22 public: | 19 public: |
| 23 HostEventLogger(ChromotingHost* host, const std::string& application_name); | 20 virtual ~HostEventLogger() {} |
| 24 virtual ~HostEventLogger(); | |
| 25 | 21 |
| 26 // HostStatusObserver implementation. These methods will be called from the | 22 // Creates an event-logger that monitors host status changes and logs |
| 27 // network thread. | 23 // corresponding events to the OS-specific log (syslog/EventLog). |
| 28 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 24 static scoped_ptr<HostEventLogger> Create( |
| 29 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 25 ChromotingHost* host, const std::string& application_name); |
| 30 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; | 26 |
| 31 virtual void OnClientRouteChange( | 27 protected: |
| 32 const std::string& jid, | 28 HostEventLogger() {} |
| 33 const std::string& channel_name, | |
| 34 const net::IPEndPoint& remote_end_point, | |
| 35 const net::IPEndPoint& local_end_point) OVERRIDE; | |
| 36 virtual void OnShutdown() OVERRIDE; | |
| 37 | 29 |
| 38 private: | 30 private: |
| 39 void Log(const std::string& message); | |
| 40 | |
| 41 scoped_refptr<ChromotingHost> host_; | |
| 42 scoped_ptr<SystemEventLogger> system_event_logger_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(HostEventLogger); | 31 DISALLOW_COPY_AND_ASSIGN(HostEventLogger); |
| 45 }; | 32 }; |
| 46 | 33 |
| 47 } | 34 } |
| 48 | 35 |
| 49 #endif // REMOTING_HOST_HOST_EVENT_LOGGER_H_ | 36 #endif // REMOTING_HOST_HOST_EVENT_LOGGER_H_ |
| OLD | NEW |