OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The XmppSignalStrategy encapsulates all the logic to perform the signaling | 5 // The XmppSignalStrategy encapsulates all the logic to perform the signaling |
6 // STUN/ICE for jingle via a direct XMPP connection. | 6 // STUN/ICE for jingle via a direct XMPP connection. |
7 // | 7 // |
8 // This class is not threadsafe. | 8 // This class is not threadsafe. |
9 | 9 |
10 #ifndef REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ | 10 #ifndef REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 struct XmppServerConfig { | 43 struct XmppServerConfig { |
44 XmppServerConfig(); | 44 XmppServerConfig(); |
45 ~XmppServerConfig(); | 45 ~XmppServerConfig(); |
46 | 46 |
47 std::string host; | 47 std::string host; |
48 int port; | 48 int port; |
49 bool use_tls; | 49 bool use_tls; |
50 | 50 |
51 std::string username; | 51 std::string username; |
52 std::string auth_token; | 52 std::string auth_token; |
53 std::string auth_service; | |
54 }; | 53 }; |
55 | 54 |
56 XmppSignalStrategy( | 55 XmppSignalStrategy( |
57 net::ClientSocketFactory* socket_factory, | 56 net::ClientSocketFactory* socket_factory, |
58 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 57 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
59 const XmppServerConfig& xmpp_server_config); | 58 const XmppServerConfig& xmpp_server_config); |
60 ~XmppSignalStrategy() override; | 59 ~XmppSignalStrategy() override; |
61 | 60 |
62 // SignalStrategy interface. | 61 // SignalStrategy interface. |
63 void Connect() override; | 62 void Connect() override; |
64 void Disconnect() override; | 63 void Disconnect() override; |
65 State GetState() const override; | 64 State GetState() const override; |
66 Error GetError() const override; | 65 Error GetError() const override; |
67 std::string GetLocalJid() const override; | 66 std::string GetLocalJid() const override; |
68 void AddListener(Listener* listener) override; | 67 void AddListener(Listener* listener) override; |
69 void RemoveListener(Listener* listener) override; | 68 void RemoveListener(Listener* listener) override; |
70 bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override; | 69 bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override; |
71 std::string GetNextId() override; | 70 std::string GetNextId() override; |
72 | 71 |
73 // buzz::XmppStanzaHandler interface. | 72 // buzz::XmppStanzaHandler interface. |
74 bool HandleStanza(const buzz::XmlElement* stanza) override; | 73 bool HandleStanza(const buzz::XmlElement* stanza) override; |
75 | 74 |
76 // This method is used to update the auth info (for example when the OAuth | 75 // This method is used to update the auth info (for example when the OAuth |
77 // access token is renewed). It is OK to call this even when we are in the | 76 // access token is renewed). It is OK to call this even when we are in the |
78 // CONNECTED state. It will be used on the next Connect() call. | 77 // CONNECTED state. It will be used on the next Connect() call. |
79 void SetAuthInfo(const std::string& username, | 78 void SetAuthInfo(const std::string& username, |
80 const std::string& auth_token, | 79 const std::string& auth_token); |
81 const std::string& auth_service); | |
82 | 80 |
83 // Use this method to override the default resource name used (optional). | 81 // Use this method to override the default resource name used (optional). |
84 // This will be used on the next Connect() call. | 82 // This will be used on the next Connect() call. |
85 void SetResourceName(const std::string& resource_name); | 83 void SetResourceName(const std::string& resource_name); |
86 | 84 |
87 private: | 85 private: |
88 static buzz::PreXmppAuth* CreatePreXmppAuth( | 86 static buzz::PreXmppAuth* CreatePreXmppAuth( |
89 const buzz::XmppClientSettings& settings); | 87 const buzz::XmppClientSettings& settings); |
90 | 88 |
91 void OnConnectionStateChanged(buzz::XmppEngine::State state); | 89 void OnConnectionStateChanged(buzz::XmppEngine::State state); |
(...skipping 14 matching lines...) Expand all Loading... |
106 ObserverList<Listener, true> listeners_; | 104 ObserverList<Listener, true> listeners_; |
107 | 105 |
108 base::RepeatingTimer<XmppSignalStrategy> keep_alive_timer_; | 106 base::RepeatingTimer<XmppSignalStrategy> keep_alive_timer_; |
109 | 107 |
110 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy); | 108 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy); |
111 }; | 109 }; |
112 | 110 |
113 } // namespace remoting | 111 } // namespace remoting |
114 | 112 |
115 #endif // REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ | 113 #endif // REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ |
OLD | NEW |