Chromium Code Reviews| 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 class LogToServer : | |
|
Sergey Ulanov
2011/11/17 01:16:33
nit: move : to the next line.
simonmorris
2011/11/18 19:23:04
Done.
| |
| 28 public HostStatusObserver, | |
| 29 public base::RefCountedThreadSafe<LogToServer> { | |
|
Sergey Ulanov
2011/11/17 01:16:33
given that this object outlives the host (it must
simonmorris
2011/11/18 19:23:04
Done.
| |
| 30 public: | |
| 31 LogToServer(base::MessageLoopProxy* message_loop); | |
|
Sergey Ulanov
2011/11/17 01:16:33
explicit
simonmorris
2011/11/18 19:23:04
Done.
| |
| 32 | |
| 33 // Logs a session state change. | |
| 34 // Currently, this is either connection or disconnection. | |
| 35 void LogSessionStateChange(bool connected); | |
| 36 | |
| 37 // HostStatusObserver implementation. | |
| 38 virtual void OnSignallingConnected(SignalStrategy* signal_strategy, | |
| 39 const std::string& full_jid) OVERRIDE; | |
| 40 virtual void OnSignallingDisconnected() OVERRIDE; | |
| 41 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | |
| 42 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | |
| 43 virtual void OnAccessDenied() OVERRIDE; | |
| 44 virtual void OnShutdown() OVERRIDE; | |
| 45 | |
| 46 private: | |
| 47 friend class base::RefCountedThreadSafe<LogToServer>; | |
| 48 virtual ~LogToServer(); | |
| 49 | |
| 50 void Log(const ServerLogEntry& entry); | |
| 51 void SendPendingEntries(); | |
| 52 void ProcessResponse(const buzz::XmlElement* response); | |
| 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 |