OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_LOG_TO_SERVER_H_ |
| 6 #define REMOTING_HOST_LOG_TO_SERVER_H_ |
| 7 |
| 8 #include <deque> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "remoting/host/host_status_observer.h" |
| 13 #include "remoting/host/server_log_entry.h" |
| 14 |
| 15 namespace base { |
| 16 class MessageLoopProxy; |
| 17 } // namespace base |
| 18 |
| 19 namespace buzz { |
| 20 class XmlElement; |
| 21 } // namespace buzz |
| 22 |
| 23 namespace remoting { |
| 24 |
| 25 class IqSender; |
| 26 |
| 27 /** |
| 28 * A class that sends log entries to a server. |
| 29 * |
| 30 * The class is not thread-safe. |
| 31 */ |
| 32 class LogToServer : public HostStatusObserver { |
| 33 public: |
| 34 explicit LogToServer(base::MessageLoopProxy* message_loop); |
| 35 virtual ~LogToServer(); |
| 36 |
| 37 // Logs a session state change. |
| 38 // Currently, this is either connection or disconnection. |
| 39 void LogSessionStateChange(bool connected); |
| 40 |
| 41 // HostStatusObserver implementation. |
| 42 virtual void OnSignallingConnected(SignalStrategy* signal_strategy, |
| 43 const std::string& full_jid) OVERRIDE; |
| 44 virtual void OnSignallingDisconnected() OVERRIDE; |
| 45 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
| 46 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
| 47 virtual void OnAccessDenied() OVERRIDE; |
| 48 virtual void OnShutdown() OVERRIDE; |
| 49 |
| 50 private: |
| 51 void Log(const ServerLogEntry& entry); |
| 52 void SendPendingEntries(); |
| 53 |
| 54 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 55 scoped_ptr<IqSender> iq_sender_; |
| 56 std::deque<ServerLogEntry> pending_entries_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(LogToServer); |
| 59 }; |
| 60 |
| 61 } // namespace remoting |
| 62 |
| 63 #endif // REMOTING_HOST_LOG_TO_SERVER_H_ |
OLD | NEW |