OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_JINGLE_GLUE_JINGLE_CLIENT_H_ | 5 #ifndef REMOTING_JINGLE_GLUE_JINGLE_CLIENT_H_ |
6 #define REMOTING_JINGLE_GLUE_JINGLE_CLIENT_H_ | 6 #define REMOTING_JINGLE_GLUE_JINGLE_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "remoting/jingle_glue/jingle_channel.h" | 10 #include "remoting/jingle_glue/jingle_channel.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace cricket { | 23 namespace cricket { |
24 class BasicPortAllocator; | 24 class BasicPortAllocator; |
25 class SessionManager; | 25 class SessionManager; |
26 class TunnelSessionClient; | 26 class TunnelSessionClient; |
27 class SessionManagerTask; | 27 class SessionManagerTask; |
28 class Session; | 28 class Session; |
29 } // namespace cricket | 29 } // namespace cricket |
30 | 30 |
31 namespace remoting { | 31 namespace remoting { |
32 | 32 |
| 33 class IqRequest; |
| 34 |
33 class JingleClient : public base::RefCountedThreadSafe<JingleClient>, | 35 class JingleClient : public base::RefCountedThreadSafe<JingleClient>, |
34 public sigslot::has_slots<> { | 36 public sigslot::has_slots<> { |
35 public: | 37 public: |
36 enum State { | 38 enum State { |
37 START, // Initial state. | 39 CREATED, // Initial state. |
| 40 INITIALIZED, |
38 CONNECTING, | 41 CONNECTING, |
39 CONNECTED, | 42 CONNECTED, |
40 CLOSED, | 43 CLOSED, |
41 }; | 44 }; |
42 | 45 |
43 class Callback { | 46 class Callback { |
44 public: | 47 public: |
45 virtual ~Callback() {} | 48 virtual ~Callback() {} |
46 | 49 |
47 // Called when state of the connection is changed. | 50 // Called when state of the connection is changed. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 JingleChannel::Callback* callback); | 84 JingleChannel::Callback* callback); |
82 | 85 |
83 // Closes XMPP connection and stops the thread. Must be called before the | 86 // Closes XMPP connection and stops the thread. Must be called before the |
84 // object is destroyed. | 87 // object is destroyed. |
85 void Close(); | 88 void Close(); |
86 | 89 |
87 // Returns JID with resource ID. Empty string is returned if full JID is not | 90 // Returns JID with resource ID. Empty string is returned if full JID is not |
88 // known yet, i.e. authentication hasn't finished. | 91 // known yet, i.e. authentication hasn't finished. |
89 std::string GetFullJid(); | 92 std::string GetFullJid(); |
90 | 93 |
| 94 // Creates new IqRequest for this client. Ownership for of the created object |
| 95 // is transfered to the caller. |
| 96 virtual IqRequest* CreateIqRequest(); |
| 97 |
91 // Current state of the client. | 98 // Current state of the client. |
92 State state() { return state_; } | 99 State state() { return state_; } |
93 | 100 |
94 // Returns XmppClient object for the xmpp connection or NULL if not connected. | 101 // Returns XmppClient object for the xmpp connection or NULL if not connected. |
95 buzz::XmppClient* xmpp_client() { return client_; } | 102 buzz::XmppClient* xmpp_client() { return client_; } |
96 | 103 |
97 // Message loop used by this object to execute tasks. | 104 // Message loop used by this object to execute tasks. |
98 MessageLoop* message_loop(); | 105 MessageLoop* message_loop(); |
99 | 106 |
100 private: | 107 private: |
| 108 friend class HeartbeatSenderTest; |
| 109 |
101 void OnConnectionStateChanged(buzz::XmppEngine::State state); | 110 void OnConnectionStateChanged(buzz::XmppEngine::State state); |
102 | 111 |
103 void OnIncomingTunnel(cricket::TunnelSessionClient* client, buzz::Jid jid, | 112 void OnIncomingTunnel(cricket::TunnelSessionClient* client, buzz::Jid jid, |
104 std::string description, cricket::Session* session); | 113 std::string description, cricket::Session* session); |
105 | 114 |
106 void DoInitialize(const std::string& username, | 115 void DoInitialize(const std::string& username, |
107 const std::string& auth_token, | 116 const std::string& auth_token, |
108 const std::string& auth_token_service); | 117 const std::string& auth_token_service); |
109 | 118 |
110 // Used by Connect(). | 119 // Used by Connect(). |
(...skipping 23 matching lines...) Expand all Loading... |
134 scoped_ptr<cricket::BasicPortAllocator> port_allocator_; | 143 scoped_ptr<cricket::BasicPortAllocator> port_allocator_; |
135 scoped_ptr<cricket::SessionManager> session_manager_; | 144 scoped_ptr<cricket::SessionManager> session_manager_; |
136 scoped_ptr<cricket::TunnelSessionClient> tunnel_session_client_; | 145 scoped_ptr<cricket::TunnelSessionClient> tunnel_session_client_; |
137 | 146 |
138 DISALLOW_COPY_AND_ASSIGN(JingleClient); | 147 DISALLOW_COPY_AND_ASSIGN(JingleClient); |
139 }; | 148 }; |
140 | 149 |
141 } // namespace remoting | 150 } // namespace remoting |
142 | 151 |
143 #endif // REMOTING_JINGLE_GLUE_JINGLE_CLIENT_H_ | 152 #endif // REMOTING_JINGLE_GLUE_JINGLE_CLIENT_H_ |
OLD | NEW |