OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ipc_host_event_logger.h" | 5 #include "remoting/host/ipc_host_event_logger.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ipc/ipc_sender.h" | 8 #include "ipc/ipc_sender.h" |
9 #include "net/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
10 #include "remoting/host/chromoting_messages.h" | 10 #include "remoting/host/chromoting_messages.h" |
11 #include "remoting/host/host_status_monitor.h" | 11 #include "remoting/host/host_status_monitor.h" |
12 #include "remoting/protocol/transport.h" | 12 #include "remoting/protocol/transport.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 | 15 |
16 IpcHostEventLogger::IpcHostEventLogger(base::WeakPtr<HostStatusMonitor> monitor, | 16 IpcHostEventLogger::IpcHostEventLogger(base::WeakPtr<HostStatusMonitor> monitor, |
17 IPC::Sender* daemon_channel) | 17 IPC::Sender* daemon_channel) |
18 : daemon_channel_(daemon_channel), | 18 : daemon_channel_(daemon_channel), |
19 monitor_(monitor) { | 19 monitor_(monitor) { |
20 monitor_->AddStatusObserver(this); | 20 monitor_->AddStatusObserver(this); |
21 } | 21 } |
22 | 22 |
23 IpcHostEventLogger::~IpcHostEventLogger() { | 23 IpcHostEventLogger::~IpcHostEventLogger() { |
24 DCHECK(CalledOnValidThread()); | 24 DCHECK(CalledOnValidThread()); |
25 | 25 |
26 if (monitor_) | 26 if (monitor_.get()) |
27 monitor_->RemoveStatusObserver(this); | 27 monitor_->RemoveStatusObserver(this); |
28 } | 28 } |
29 | 29 |
30 void IpcHostEventLogger::OnAccessDenied(const std::string& jid) { | 30 void IpcHostEventLogger::OnAccessDenied(const std::string& jid) { |
31 DCHECK(CalledOnValidThread()); | 31 DCHECK(CalledOnValidThread()); |
32 | 32 |
33 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_AccessDenied(jid)); | 33 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_AccessDenied(jid)); |
34 } | 34 } |
35 | 35 |
36 void IpcHostEventLogger::OnClientAuthenticated(const std::string& jid) { | 36 void IpcHostEventLogger::OnClientAuthenticated(const std::string& jid) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_HostShutdown()); | 75 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_HostShutdown()); |
76 } | 76 } |
77 | 77 |
78 void IpcHostEventLogger::OnStart(const std::string& xmpp_login) { | 78 void IpcHostEventLogger::OnStart(const std::string& xmpp_login) { |
79 DCHECK(CalledOnValidThread()); | 79 DCHECK(CalledOnValidThread()); |
80 | 80 |
81 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_HostStarted(xmpp_login)); | 81 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_HostStarted(xmpp_login)); |
82 } | 82 } |
83 | 83 |
84 } // namespace remoting | 84 } // namespace remoting |
OLD | NEW |