blob: 2aa41bc274dd76c78f880a4e8d5bb20bc1fb09e9 [file] [log] [blame]
// Copyright (c) 2011 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 <map>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/jingle_glue/signal_strategy.h"
#include "third_party/libjingle/source/talk/base/sigslot.h"
namespace buzz {
class XmlElement;
} // namespace buzz
namespace cricket {
class SessionManager;
} // namespace cricket
namespace remoting {
class IqRequest;
// This class handles proxying the Jingle establishment messages between the
// client and the server when proxying XMPP through Javascript.
// The |request| object is used to send and receive IQ stanzas from the XMPP
// network. The |session_manager| controls sending and receiving of stanzas
// after Run() is invoked.
// This class is not threadsafe, and should only be used on the thread it is
// created on.
class JingleSignalingConnector : public SignalStrategy::Listener,
public sigslot::has_slots<> {
JingleSignalingConnector(SignalStrategy* signal_strategy,
cricket::SessionManager* session_manager);
virtual ~JingleSignalingConnector();
// SignalStrategy::Listener interface.
virtual bool OnIncomingStanza(const buzz::XmlElement* stanza) OVERRIDE;
typedef std::map<std::string, buzz::XmlElement*> IqRequestsMap;
void OnOutgoingMessage(cricket::SessionManager* manager,
const buzz::XmlElement* stanza);
SignalStrategy* signal_strategy_;
cricket::SessionManager* session_manager_;
IqRequestsMap pending_requests_;
} // namespace remoting