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 #ifndef REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ | 5 #ifndef REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ |
6 #define REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ | 6 #define REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ |
7 | 7 |
8 #include "remoting/signaling/signal_strategy.h" | 8 #include "remoting/signaling/signal_strategy.h" |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class ClientSocketFactory; | 17 class ClientSocketFactory; |
18 class URLRequestContextGetter; | 18 class URLRequestContextGetter; |
19 } // namespace net | 19 } // namespace net |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 | 22 |
23 // XmppSignalStrategy implements SignalStrategy using direct XMPP connection. | 23 // XmppSignalStrategy implements SignalStrategy using direct XMPP connection. |
| 24 // This class can be created on a different thread from the one it is used (when |
| 25 // Connect() is called). |
24 class XmppSignalStrategy : public SignalStrategy { | 26 class XmppSignalStrategy : public SignalStrategy { |
25 public: | 27 public: |
26 // XMPP Server configuration for XmppSignalStrategy. | 28 // XMPP Server configuration for XmppSignalStrategy. |
27 struct XmppServerConfig { | 29 struct XmppServerConfig { |
28 XmppServerConfig(); | 30 XmppServerConfig(); |
29 XmppServerConfig(const XmppServerConfig& other); | 31 XmppServerConfig(const XmppServerConfig& other); |
30 ~XmppServerConfig(); | 32 ~XmppServerConfig(); |
31 | 33 |
32 std::string host; | 34 std::string host; |
33 int port; | 35 int port; |
(...skipping 20 matching lines...) Expand all Loading... |
54 bool SendStanza(std::unique_ptr<buzz::XmlElement> stanza) override; | 56 bool SendStanza(std::unique_ptr<buzz::XmlElement> stanza) override; |
55 std::string GetNextId() override; | 57 std::string GetNextId() override; |
56 | 58 |
57 // This method is used to update the auth info (for example when the OAuth | 59 // This method is used to update the auth info (for example when the OAuth |
58 // access token is renewed). It is OK to call this even when we are in the | 60 // access token is renewed). It is OK to call this even when we are in the |
59 // CONNECTED state. It will be used on the next Connect() call. | 61 // CONNECTED state. It will be used on the next Connect() call. |
60 void SetAuthInfo(const std::string& username, | 62 void SetAuthInfo(const std::string& username, |
61 const std::string& auth_token); | 63 const std::string& auth_token); |
62 | 64 |
63 private: | 65 private: |
| 66 // This ensures that even if a Listener deletes the current instance during |
| 67 // OnSignalStrategyIncomingStanza(), we can delete |core_| asynchronously. |
64 class Core; | 68 class Core; |
65 | 69 |
66 std::unique_ptr<Core> core_; | 70 std::unique_ptr<Core> core_; |
67 | 71 |
68 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy); | 72 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy); |
69 }; | 73 }; |
70 | 74 |
71 } // namespace remoting | 75 } // namespace remoting |
72 | 76 |
73 #endif // REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ | 77 #endif // REMOTING_SIGNALING_XMPP_SIGNAL_STRATEGY_H_ |
OLD | NEW |