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 #ifndef REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_ | 5 #ifndef REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_ |
6 #define REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_ | 6 #define REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/sequence_checker.h" |
15 #include "remoting/host/host_event_logger.h" | 15 #include "remoting/host/host_event_logger.h" |
16 #include "remoting/host/host_status_observer.h" | 16 #include "remoting/host/host_status_observer.h" |
17 | 17 |
18 namespace IPC { | 18 namespace IPC { |
19 class Sender; | 19 class Sender; |
20 } // namespace IPC | 20 } // namespace IPC |
21 | 21 |
22 namespace remoting { | 22 namespace remoting { |
23 | 23 |
24 class HostStatusMonitor; | 24 class HostStatusMonitor; |
25 | 25 |
26 class IpcHostEventLogger | 26 class IpcHostEventLogger : public HostEventLogger, public HostStatusObserver { |
27 : public base::NonThreadSafe, | |
28 public HostEventLogger, | |
29 public HostStatusObserver { | |
30 public: | 27 public: |
31 // Initializes the logger. |daemon_channel| must outlive this object. | 28 // Initializes the logger. |daemon_channel| must outlive this object. |
32 IpcHostEventLogger(base::WeakPtr<HostStatusMonitor> monitor, | 29 IpcHostEventLogger(base::WeakPtr<HostStatusMonitor> monitor, |
33 IPC::Sender* daemon_channel); | 30 IPC::Sender* daemon_channel); |
34 ~IpcHostEventLogger() override; | 31 ~IpcHostEventLogger() override; |
35 | 32 |
36 // HostStatusObserver interface. | 33 // HostStatusObserver interface. |
37 void OnAccessDenied(const std::string& jid) override; | 34 void OnAccessDenied(const std::string& jid) override; |
38 void OnClientAuthenticated(const std::string& jid) override; | 35 void OnClientAuthenticated(const std::string& jid) override; |
39 void OnClientConnected(const std::string& jid) override; | 36 void OnClientConnected(const std::string& jid) override; |
40 void OnClientDisconnected(const std::string& jid) override; | 37 void OnClientDisconnected(const std::string& jid) override; |
41 void OnClientRouteChange(const std::string& jid, | 38 void OnClientRouteChange(const std::string& jid, |
42 const std::string& channel_name, | 39 const std::string& channel_name, |
43 const protocol::TransportRoute& route) override; | 40 const protocol::TransportRoute& route) override; |
44 void OnStart(const std::string& xmpp_login) override; | 41 void OnStart(const std::string& xmpp_login) override; |
45 void OnShutdown() override; | 42 void OnShutdown() override; |
46 | 43 |
47 private: | 44 private: |
48 // Used to report host status events to the daemon. | 45 // Used to report host status events to the daemon. |
49 IPC::Sender* daemon_channel_; | 46 IPC::Sender* daemon_channel_; |
50 | 47 |
51 base::WeakPtr<HostStatusMonitor> monitor_; | 48 base::WeakPtr<HostStatusMonitor> monitor_; |
52 | 49 |
| 50 SEQUENCE_CHECKER(sequence_checker_); |
| 51 |
53 DISALLOW_COPY_AND_ASSIGN(IpcHostEventLogger); | 52 DISALLOW_COPY_AND_ASSIGN(IpcHostEventLogger); |
54 }; | 53 }; |
55 | 54 |
56 } | 55 } |
57 | 56 |
58 #endif // REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_ | 57 #endif // REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_ |
OLD | NEW |