Roll ANGLE e754fb8..6ffeb74
[chromium-blink-merge.git] / remoting / signaling / xmpp_signal_strategy.h
blob62a8c18d86b4b1e945dd01a53ad48783d41722ad
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"
14 namespace net {
15 class ClientSocketFactory;
16 class URLRequestContextGetter;
17 } // namespace net
19 namespace remoting {
21 // XmppSignalStrategy implements SignalStrategy using direct XMPP connection.
22 class XmppSignalStrategy : public SignalStrategy {
23 public:
24 // XMPP Server configuration for XmppSignalStrategy.
25 struct XmppServerConfig {
26 XmppServerConfig();
27 ~XmppServerConfig();
29 std::string host;
30 int port;
31 bool use_tls;
33 std::string username;
34 std::string auth_token;
37 XmppSignalStrategy(
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);
60 private:
61 class Core;
63 scoped_ptr<Core> core_;
65 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy);
68 } // namespace remoting
70 #endif // REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_