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_XMPP_SIGNAL_STRATEGY_H_
6 #define REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_
8 #include "remoting/signaling/signal_strategy.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
15 class ClientSocketFactory
;
16 class URLRequestContextGetter
;
21 // XmppSignalStrategy implements SignalStrategy using direct XMPP connection.
22 class XmppSignalStrategy
: public SignalStrategy
{
24 // XMPP Server configuration for XmppSignalStrategy.
25 struct XmppServerConfig
{
34 std::string auth_token
;
38 net::ClientSocketFactory
* socket_factory
,
39 const scoped_refptr
<net::URLRequestContextGetter
>& request_context_getter
,
40 const XmppServerConfig
& xmpp_server_config
);
41 ~XmppSignalStrategy() override
;
43 // SignalStrategy interface.
44 void Connect() override
;
45 void Disconnect() override
;
46 State
GetState() const override
;
47 Error
GetError() const override
;
48 std::string
GetLocalJid() const override
;
49 void AddListener(Listener
* listener
) override
;
50 void RemoveListener(Listener
* listener
) override
;
51 bool SendStanza(scoped_ptr
<buzz::XmlElement
> stanza
) override
;
52 std::string
GetNextId() override
;
54 // This method is used to update the auth info (for example when the OAuth
55 // access token is renewed). It is OK to call this even when we are in the
56 // CONNECTED state. It will be used on the next Connect() call.
57 void SetAuthInfo(const std::string
& username
,
58 const std::string
& auth_token
);
63 scoped_ptr
<Core
> core_
;
65 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy
);
68 } // namespace remoting
70 #endif // REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_