OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // A class that manages a connection to an XMPP server. | 5 // A class that manages a connection to an XMPP server. |
6 | 6 |
7 #ifndef JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ | 7 #ifndef JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ |
8 #define JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ | 8 #define JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // | 67 // |
68 // TODO(akalin): Avoid the need for |pre_xmpp_auth|. | 68 // TODO(akalin): Avoid the need for |pre_xmpp_auth|. |
69 XmppConnection(const buzz::XmppClientSettings& xmpp_client_settings, | 69 XmppConnection(const buzz::XmppClientSettings& xmpp_client_settings, |
70 const scoped_refptr<net::URLRequestContextGetter>& | 70 const scoped_refptr<net::URLRequestContextGetter>& |
71 request_context_getter, | 71 request_context_getter, |
72 Delegate* delegate, buzz::PreXmppAuth* pre_xmpp_auth); | 72 Delegate* delegate, buzz::PreXmppAuth* pre_xmpp_auth); |
73 | 73 |
74 // Invalidates any weak pointers passed to the delegate by | 74 // Invalidates any weak pointers passed to the delegate by |
75 // OnConnect(), but does not trigger a call to the delegate's | 75 // OnConnect(), but does not trigger a call to the delegate's |
76 // OnError() function. | 76 // OnError() function. |
77 ~XmppConnection(); | 77 virtual ~XmppConnection(); |
78 | 78 |
79 private: | 79 private: |
80 void OnStateChange(buzz::XmppEngine::State state); | 80 void OnStateChange(buzz::XmppEngine::State state); |
81 void OnInputLog(const char* data, int len); | 81 void OnInputLog(const char* data, int len); |
82 void OnOutputLog(const char* data, int len); | 82 void OnOutputLog(const char* data, int len); |
83 | 83 |
84 void ClearClient(); | 84 void ClearClient(); |
85 | 85 |
86 base::NonThreadSafe non_thread_safe_; | 86 base::NonThreadSafe non_thread_safe_; |
87 scoped_ptr<TaskPump> task_pump_; | 87 scoped_ptr<TaskPump> task_pump_; |
88 base::WeakPtr<WeakXmppClient> weak_xmpp_client_; | 88 base::WeakPtr<WeakXmppClient> weak_xmpp_client_; |
89 bool on_connect_called_; | 89 bool on_connect_called_; |
90 Delegate* delegate_; | 90 Delegate* delegate_; |
91 | 91 |
92 FRIEND_TEST(XmppConnectionTest, RaisedError); | 92 FRIEND_TEST(XmppConnectionTest, RaisedError); |
93 FRIEND_TEST(XmppConnectionTest, Connect); | 93 FRIEND_TEST(XmppConnectionTest, Connect); |
94 FRIEND_TEST(XmppConnectionTest, MultipleConnect); | 94 FRIEND_TEST(XmppConnectionTest, MultipleConnect); |
95 FRIEND_TEST(XmppConnectionTest, ConnectThenError); | 95 FRIEND_TEST(XmppConnectionTest, ConnectThenError); |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(XmppConnection); | 97 DISALLOW_COPY_AND_ASSIGN(XmppConnection); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace notifier | 100 } // namespace notifier |
101 | 101 |
102 #endif // JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ | 102 #endif // JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ |
OLD | NEW |