| 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 <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.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 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/non_thread_safe.h" | 16 #include "base/sequence_checker.h" |
| 17 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
| 18 #include "third_party/libjingle_xmpp/xmpp/xmppengine.h" | 18 #include "third_party/libjingle_xmpp/xmpp/xmppengine.h" |
| 19 #include "webrtc/base/sigslot.h" | 19 #include "webrtc/base/sigslot.h" |
| 20 | 20 |
| 21 namespace buzz { | 21 namespace buzz { |
| 22 class PreXmppAuth; | 22 class PreXmppAuth; |
| 23 class XmlElement; | 23 class XmlElement; |
| 24 class XmppClientSettings; | 24 class XmppClientSettings; |
| 25 class XmppTaskParentInterface; | 25 class XmppTaskParentInterface; |
| 26 } // namespace buzz | 26 } // namespace buzz |
| 27 | 27 |
| 28 namespace jingle_glue { | 28 namespace jingle_glue { |
| 29 class TaskPump; | 29 class TaskPump; |
| 30 } // namespace jingle_glue | 30 } // namespace jingle_glue |
| 31 | 31 |
| 32 namespace notifier { | 32 namespace notifier { |
| 33 | 33 |
| 34 class WeakXmppClient; | 34 class WeakXmppClient; |
| 35 | 35 |
| 36 class XmppConnection | 36 class XmppConnection : public sigslot::has_slots<> { |
| 37 : public sigslot::has_slots<>, | |
| 38 public base::NonThreadSafe { | |
| 39 public: | 37 public: |
| 40 class Delegate { | 38 class Delegate { |
| 41 public: | 39 public: |
| 42 // Called (at most once) when a connection has been established. | 40 // Called (at most once) when a connection has been established. |
| 43 // |base_task| can be used by the client as the parent of any Task | 41 // |base_task| can be used by the client as the parent of any Task |
| 44 // it creates as long as it is valid (i.e., non-NULL). | 42 // it creates as long as it is valid (i.e., non-NULL). |
| 45 virtual void OnConnect( | 43 virtual void OnConnect( |
| 46 base::WeakPtr<buzz::XmppTaskParentInterface> base_task) = 0; | 44 base::WeakPtr<buzz::XmppTaskParentInterface> base_task) = 0; |
| 47 | 45 |
| 48 // Called if an error has occurred (either before or after a call | 46 // Called if an error has occurred (either before or after a call |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 void OnInputLog(const char* data, int len); | 90 void OnInputLog(const char* data, int len); |
| 93 void OnOutputLog(const char* data, int len); | 91 void OnOutputLog(const char* data, int len); |
| 94 | 92 |
| 95 void ClearClient(); | 93 void ClearClient(); |
| 96 | 94 |
| 97 std::unique_ptr<jingle_glue::TaskPump> task_pump_; | 95 std::unique_ptr<jingle_glue::TaskPump> task_pump_; |
| 98 base::WeakPtr<WeakXmppClient> weak_xmpp_client_; | 96 base::WeakPtr<WeakXmppClient> weak_xmpp_client_; |
| 99 bool on_connect_called_; | 97 bool on_connect_called_; |
| 100 Delegate* delegate_; | 98 Delegate* delegate_; |
| 101 | 99 |
| 100 SEQUENCE_CHECKER(sequence_checker_); |
| 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(XmppConnection); | 102 DISALLOW_COPY_AND_ASSIGN(XmppConnection); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace notifier | 105 } // namespace notifier |
| 106 | 106 |
| 107 #endif // JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ | 107 #endif // JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ |
| OLD | NEW |