OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_LOG_TO_SERVER_H_ | 5 #ifndef REMOTING_HOST_LOG_TO_SERVER_H_ |
6 #define REMOTING_HOST_LOG_TO_SERVER_H_ | 6 #define REMOTING_HOST_LOG_TO_SERVER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "remoting/host/host_status_observer.h" | 12 #include "remoting/host/host_status_observer.h" |
13 #include "remoting/host/server_log_entry.h" | 13 #include "remoting/host/server_log_entry.h" |
14 #include "remoting/jingle_glue/signal_strategy.h" | |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class MessageLoopProxy; | 17 class MessageLoopProxy; |
17 } // namespace base | 18 } // namespace base |
18 | 19 |
19 namespace buzz { | 20 namespace buzz { |
20 class XmlElement; | 21 class XmlElement; |
21 } // namespace buzz | 22 } // namespace buzz |
22 | 23 |
23 namespace remoting { | 24 namespace remoting { |
24 | 25 |
26 class ChromotingHost; | |
25 class IqSender; | 27 class IqSender; |
26 | 28 |
27 /** | 29 /** |
28 * A class that sends log entries to a server. | 30 * A class that sends log entries to a server. |
29 * | 31 * |
30 * The class is not thread-safe. | 32 * The class is not thread-safe. |
Wez
2012/01/03 16:25:04
nit: C++ify this comment, and clarify that "not th
Sergey Ulanov
2012/01/03 21:51:02
Done. Removed the comment about non thread-safe. W
| |
31 */ | 33 */ |
32 class LogToServer : public HostStatusObserver { | 34 class LogToServer : public HostStatusObserver, |
35 public SignalStrategy::Listener { | |
33 public: | 36 public: |
34 explicit LogToServer(base::MessageLoopProxy* message_loop); | 37 explicit LogToServer(SignalStrategy* signal_strategy); |
35 virtual ~LogToServer(); | 38 virtual ~LogToServer(); |
36 | 39 |
37 // Logs a session state change. | 40 // Logs a session state change. |
38 // Currently, this is either connection or disconnection. | 41 // Currently, this is either connection or disconnection. |
39 void LogSessionStateChange(bool connected); | 42 void LogSessionStateChange(bool connected); |
40 | 43 |
41 // HostStatusObserver implementation. | 44 // SignalStrategy::Listener interface. |
42 virtual void OnSignallingConnected(SignalStrategy* signal_strategy) OVERRIDE; | 45 virtual void OnSignalStrategyStateChange( |
43 virtual void OnSignallingDisconnected() OVERRIDE; | 46 SignalStrategy::State state) OVERRIDE; |
47 | |
48 // HostStatusObserver interface. | |
44 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 49 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
45 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 50 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
46 virtual void OnAccessDenied() OVERRIDE; | 51 virtual void OnAccessDenied() OVERRIDE; |
47 virtual void OnShutdown() OVERRIDE; | 52 virtual void OnShutdown() OVERRIDE; |
48 | 53 |
49 private: | 54 private: |
50 void Log(const ServerLogEntry& entry); | 55 void Log(const ServerLogEntry& entry); |
51 void SendPendingEntries(); | 56 void SendPendingEntries(); |
52 | 57 |
53 scoped_refptr<base::MessageLoopProxy> message_loop_; | 58 scoped_refptr<ChromotingHost> host_; |
59 SignalStrategy* signal_strategy_; | |
54 scoped_ptr<IqSender> iq_sender_; | 60 scoped_ptr<IqSender> iq_sender_; |
55 std::deque<ServerLogEntry> pending_entries_; | 61 std::deque<ServerLogEntry> pending_entries_; |
56 | 62 |
57 DISALLOW_COPY_AND_ASSIGN(LogToServer); | 63 DISALLOW_COPY_AND_ASSIGN(LogToServer); |
58 }; | 64 }; |
59 | 65 |
60 } // namespace remoting | 66 } // namespace remoting |
61 | 67 |
62 #endif // REMOTING_HOST_LOG_TO_SERVER_H_ | 68 #endif // REMOTING_HOST_LOG_TO_SERVER_H_ |
OLD | NEW |