blob: cfae0548f85a72efa490b61902efa5d8daae13b1 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <deque>
#include <map>
#include <string>
#include "base/threading/non_thread_safe.h"
#include "remoting/signaling/server_log_entry.h"
#include "remoting/signaling/signal_strategy.h"
namespace buzz {
class XmlElement;
} // namespace buzz
namespace remoting {
class IqSender;
// LogToServer sends log entries to a server.
// The contents of the log entries are described in
// They do not contain any personally identifiable information.
class LogToServer : public base::NonThreadSafe,
public SignalStrategy::Listener {
LogToServer(ServerLogEntry::Mode mode,
SignalStrategy* signal_strategy,
const std::string& directory_bot_jid);
virtual ~LogToServer();
// SignalStrategy::Listener interface.
virtual void OnSignalStrategyStateChange(
SignalStrategy::State state) OVERRIDE;
virtual bool OnSignalStrategyIncomingStanza(
const buzz::XmlElement* stanza) OVERRIDE;
void Log(const ServerLogEntry& entry);
ServerLogEntry::Mode mode() { return mode_; }
void SendPendingEntries();
ServerLogEntry::Mode mode_;
SignalStrategy* signal_strategy_;
scoped_ptr<IqSender> iq_sender_;
std::string directory_bot_jid_;
std::deque<ServerLogEntry> pending_entries_;
} // namespace remoting