Chromium Code Reviews| 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_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 #include <map> | |
| 10 #include <string> | |
| 9 | 11 |
| 10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 13 #include "remoting/host/host_status_observer.h" | 15 #include "remoting/host/host_status_observer.h" |
| 14 #include "remoting/host/server_log_entry.h" | 16 #include "remoting/host/server_log_entry.h" |
| 15 #include "remoting/jingle_glue/signal_strategy.h" | 17 #include "remoting/jingle_glue/signal_strategy.h" |
| 16 #include "remoting/protocol/transport.h" | 18 #include "remoting/protocol/transport.h" |
| 17 | 19 |
| 18 namespace base { | 20 namespace base { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 35 public HostStatusObserver, | 37 public HostStatusObserver, |
| 36 public SignalStrategy::Listener { | 38 public SignalStrategy::Listener { |
| 37 public: | 39 public: |
| 38 explicit LogToServer(ChromotingHost* host, | 40 explicit LogToServer(ChromotingHost* host, |
| 39 ServerLogEntry::Mode mode, | 41 ServerLogEntry::Mode mode, |
| 40 SignalStrategy* signal_strategy); | 42 SignalStrategy* signal_strategy); |
| 41 virtual ~LogToServer(); | 43 virtual ~LogToServer(); |
| 42 | 44 |
| 43 // Logs a session state change. Currently, this is either | 45 // Logs a session state change. Currently, this is either |
| 44 // connection or disconnection. | 46 // connection or disconnection. |
| 45 void LogSessionStateChange(bool connected); | 47 void LogSessionStateChange(const std::string& jid, bool connected); |
| 46 | 48 |
| 47 // SignalStrategy::Listener interface. | 49 // SignalStrategy::Listener interface. |
| 48 virtual void OnSignalStrategyStateChange( | 50 virtual void OnSignalStrategyStateChange( |
| 49 SignalStrategy::State state) OVERRIDE; | 51 SignalStrategy::State state) OVERRIDE; |
| 50 | 52 |
| 51 // HostStatusObserver interface. | 53 // HostStatusObserver interface. |
| 52 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 54 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
| 53 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 55 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
| 54 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; | 56 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; |
| 55 virtual void OnClientRouteChange( | 57 virtual void OnClientRouteChange( |
| 56 const std::string& jid, | 58 const std::string& jid, |
| 57 const std::string& channel_name, | 59 const std::string& channel_name, |
| 58 const protocol::TransportRoute& route) OVERRIDE; | 60 const protocol::TransportRoute& route) OVERRIDE; |
| 59 virtual void OnShutdown() OVERRIDE; | 61 virtual void OnShutdown() OVERRIDE; |
| 60 | 62 |
| 61 private: | 63 private: |
| 64 class ConnectionInfo { | |
| 65 public: | |
| 66 ConnectionInfo(); | |
| 67 void set_route_type(const protocol::TransportRoute::RouteType& route_type); | |
| 68 protocol::TransportRoute::RouteType get_route_type() const; | |
| 69 bool get_route_type_set() const; | |
| 70 | |
| 71 private: | |
| 72 protocol::TransportRoute::RouteType route_type_; | |
| 73 bool route_type_set_; | |
|
Wez
2012/05/21 20:40:13
Can you use the presence of an entry for the clien
simonmorris
2012/05/21 22:34:36
Done.
| |
| 74 }; | |
| 75 | |
| 62 void Log(const ServerLogEntry& entry); | 76 void Log(const ServerLogEntry& entry); |
| 63 void SendPendingEntries(); | 77 void SendPendingEntries(); |
| 64 | 78 |
| 65 scoped_refptr<ChromotingHost> host_; | 79 scoped_refptr<ChromotingHost> host_; |
| 66 ServerLogEntry::Mode mode_; | 80 ServerLogEntry::Mode mode_; |
| 67 SignalStrategy* signal_strategy_; | 81 SignalStrategy* signal_strategy_; |
| 68 scoped_ptr<IqSender> iq_sender_; | 82 scoped_ptr<IqSender> iq_sender_; |
| 69 protocol::TransportRoute::RouteType connection_type_; | 83 // A map from client JID to info about that client's connection to this host. |
| 70 bool connection_type_set_; | 84 std::map<std::string, ConnectionInfo> connection_info_; |
| 71 std::deque<ServerLogEntry> pending_entries_; | 85 std::deque<ServerLogEntry> pending_entries_; |
| 72 | 86 |
| 73 DISALLOW_COPY_AND_ASSIGN(LogToServer); | 87 DISALLOW_COPY_AND_ASSIGN(LogToServer); |
| 74 }; | 88 }; |
| 75 | 89 |
| 76 } // namespace remoting | 90 } // namespace remoting |
| 77 | 91 |
| 78 #endif // REMOTING_HOST_LOG_TO_SERVER_H_ | 92 #endif // REMOTING_HOST_LOG_TO_SERVER_H_ |
| OLD | NEW |