Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / remoting / signaling / log_to_server.h
blobfd03235881daacdca2868ee36fbbbd5f013ce1ed
1 // Copyright 2014 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.
5 #ifndef REMOTING_SIGNALING_LOG_TO_SERVER_H_
6 #define REMOTING_SIGNALING_LOG_TO_SERVER_H_
8 #include <deque>
9 #include <map>
10 #include <string>
12 #include "base/threading/non_thread_safe.h"
13 #include "remoting/signaling/server_log_entry.h"
14 #include "remoting/signaling/signal_strategy.h"
16 namespace buzz {
17 class XmlElement;
18 } // namespace buzz
20 namespace remoting {
22 class IqSender;
24 // LogToServer sends log entries to a server.
25 // The contents of the log entries are described in server_log_entry.cc.
26 // They do not contain any personally identifiable information.
27 class LogToServer : public base::NonThreadSafe,
28 public SignalStrategy::Listener {
29 public:
30 LogToServer(ServerLogEntry::Mode mode,
31 SignalStrategy* signal_strategy,
32 const std::string& directory_bot_jid);
33 ~LogToServer() override;
35 // SignalStrategy::Listener interface.
36 void OnSignalStrategyStateChange(SignalStrategy::State state) override;
37 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override;
39 void Log(const ServerLogEntry& entry);
41 ServerLogEntry::Mode mode() { return mode_; }
43 private:
44 void SendPendingEntries();
46 ServerLogEntry::Mode mode_;
47 SignalStrategy* signal_strategy_;
48 scoped_ptr<IqSender> iq_sender_;
49 std::string directory_bot_jid_;
51 std::deque<ServerLogEntry> pending_entries_;
53 DISALLOW_COPY_AND_ASSIGN(LogToServer);
56 } // namespace remoting
58 #endif // REMOTING_SIGNALING_LOG_TO_SERVER_H_