| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
| 17 #include "webrtc/base/sigslot.h" | 17 #include "webrtc/base/sigslot.h" |
| 18 #include "webrtc/libjingle/xmpp/xmppengine.h" | 18 #include "webrtc/libjingle/xmpp/xmppengine.h" |
| 19 | 19 |
| 20 namespace buzz { | 20 namespace buzz { |
| 21 class PreXmppAuth; | 21 class PreXmppAuth; |
| 22 class XmlElement; | 22 class XmlElement; |
| 23 class XmppClientSettings; | 23 class XmppClientSettings; |
| 24 class XmppTaskParentInterface; | 24 class XmppTaskParentInterface; |
| 25 } // namespace | 25 } // namespace buzz |
| 26 | 26 |
| 27 namespace jingle_glue { | 27 namespace jingle_glue { |
| 28 class TaskPump; | 28 class TaskPump; |
| 29 } // namespace jingle_glue | 29 } // namespace jingle_glue |
| 30 | 30 |
| 31 namespace notifier { | 31 namespace notifier { |
| 32 | 32 |
| 33 class WeakXmppClient; | 33 class WeakXmppClient; |
| 34 | 34 |
| 35 class XmppConnection | 35 class XmppConnection |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 request_context_getter, | 73 request_context_getter, |
| 74 Delegate* delegate, | 74 Delegate* delegate, |
| 75 buzz::PreXmppAuth* pre_xmpp_auth); | 75 buzz::PreXmppAuth* pre_xmpp_auth); |
| 76 | 76 |
| 77 // Invalidates any weak pointers passed to the delegate by | 77 // Invalidates any weak pointers passed to the delegate by |
| 78 // OnConnect(), but does not trigger a call to the delegate's | 78 // OnConnect(), but does not trigger a call to the delegate's |
| 79 // OnError() function. | 79 // OnError() function. |
| 80 ~XmppConnection() override; | 80 ~XmppConnection() override; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, RaisedError); |
| 84 FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, Connect); |
| 85 FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, MultipleConnect); |
| 86 FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, ConnectThenError); |
| 87 FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, |
| 88 TasksDontRunAfterXmppConnectionDestructor); |
| 89 |
| 83 void OnStateChange(buzz::XmppEngine::State state); | 90 void OnStateChange(buzz::XmppEngine::State state); |
| 84 void OnInputLog(const char* data, int len); | 91 void OnInputLog(const char* data, int len); |
| 85 void OnOutputLog(const char* data, int len); | 92 void OnOutputLog(const char* data, int len); |
| 86 | 93 |
| 87 void ClearClient(); | 94 void ClearClient(); |
| 88 | 95 |
| 89 scoped_ptr<jingle_glue::TaskPump> task_pump_; | 96 scoped_ptr<jingle_glue::TaskPump> task_pump_; |
| 90 base::WeakPtr<WeakXmppClient> weak_xmpp_client_; | 97 base::WeakPtr<WeakXmppClient> weak_xmpp_client_; |
| 91 bool on_connect_called_; | 98 bool on_connect_called_; |
| 92 Delegate* delegate_; | 99 Delegate* delegate_; |
| 93 | 100 |
| 94 FRIEND_TEST(XmppConnectionTest, RaisedError); | |
| 95 FRIEND_TEST(XmppConnectionTest, Connect); | |
| 96 FRIEND_TEST(XmppConnectionTest, MultipleConnect); | |
| 97 FRIEND_TEST(XmppConnectionTest, ConnectThenError); | |
| 98 FRIEND_TEST(XmppConnectionTest, TasksDontRunAfterXmppConnectionDestructor); | |
| 99 | |
| 100 DISALLOW_COPY_AND_ASSIGN(XmppConnection); | 101 DISALLOW_COPY_AND_ASSIGN(XmppConnection); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace notifier | 104 } // namespace notifier |
| 104 | 105 |
| 105 #endif // JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ | 106 #endif // JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ |
| OLD | NEW |