| 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/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 HostEventLoggerPosix::HostEventLoggerPosix( | 54 HostEventLoggerPosix::HostEventLoggerPosix( |
| 55 base::WeakPtr<HostStatusMonitor> monitor, | 55 base::WeakPtr<HostStatusMonitor> monitor, |
| 56 const std::string& application_name) | 56 const std::string& application_name) |
| 57 : monitor_(monitor), | 57 : monitor_(monitor), |
| 58 application_name_(application_name) { | 58 application_name_(application_name) { |
| 59 openlog(application_name_.c_str(), 0, LOG_USER); | 59 openlog(application_name_.c_str(), 0, LOG_USER); |
| 60 monitor_->AddStatusObserver(this); | 60 monitor_->AddStatusObserver(this); |
| 61 } | 61 } |
| 62 | 62 |
| 63 HostEventLoggerPosix::~HostEventLoggerPosix() { | 63 HostEventLoggerPosix::~HostEventLoggerPosix() { |
| 64 if (monitor_) | 64 if (monitor_.get()) |
| 65 monitor_->RemoveStatusObserver(this); | 65 monitor_->RemoveStatusObserver(this); |
| 66 closelog(); | 66 closelog(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void HostEventLoggerPosix::OnClientAuthenticated(const std::string& jid) { | 69 void HostEventLoggerPosix::OnClientAuthenticated(const std::string& jid) { |
| 70 Log("Client connected: " + jid); | 70 Log("Client connected: " + jid); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void HostEventLoggerPosix::OnClientDisconnected(const std::string& jid) { | 73 void HostEventLoggerPosix::OnClientDisconnected(const std::string& jid) { |
| 74 Log("Client disconnected: " + jid); | 74 Log("Client disconnected: " + jid); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 104 | 104 |
| 105 // static | 105 // static |
| 106 scoped_ptr<HostEventLogger> HostEventLogger::Create( | 106 scoped_ptr<HostEventLogger> HostEventLogger::Create( |
| 107 base::WeakPtr<HostStatusMonitor> monitor, | 107 base::WeakPtr<HostStatusMonitor> monitor, |
| 108 const std::string& application_name) { | 108 const std::string& application_name) { |
| 109 return scoped_ptr<HostEventLogger>( | 109 return scoped_ptr<HostEventLogger>( |
| 110 new HostEventLoggerPosix(monitor, application_name)); | 110 new HostEventLoggerPosix(monitor, application_name)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace remoting | 113 } // namespace remoting |
| OLD | NEW |