Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: remoting/jingle_glue/xmpp_signal_strategy.h

Issue 8432009: Refactor IqRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // The XmppSignalStrategy encapsulates all the logic to perform the signaling 5 // The XmppSignalStrategy encapsulates all the logic to perform the signaling
6 // STUN/ICE for jingle via a direct XMPP connection. 6 // STUN/ICE for jingle via a direct XMPP connection.
7 // 7 //
8 // This class is not threadsafe. 8 // This class is not threadsafe.
9 9
10 #ifndef REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_ 10 #ifndef REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_
11 #define REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_ 11 #define REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_
12 12
13 #include "remoting/jingle_glue/signal_strategy.h" 13 #include "remoting/jingle_glue/signal_strategy.h"
14 14
15 #include <vector>
16
15 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
16 #include "remoting/jingle_glue/iq_request.h"
17 #include "third_party/libjingle/source/talk/base/sigslot.h" 18 #include "third_party/libjingle/source/talk/base/sigslot.h"
18 #include "third_party/libjingle/source/talk/xmpp/xmppclient.h" 19 #include "third_party/libjingle/source/talk/xmpp/xmppclient.h"
19 20
20 namespace remoting { 21 namespace remoting {
21 22
22 class JingleThread; 23 class JingleThread;
23 24
24 class XmppSignalStrategy : public SignalStrategy, 25 class XmppSignalStrategy : public SignalStrategy,
25 public buzz::XmppStanzaHandler, 26 public buzz::XmppStanzaHandler,
26 public sigslot::has_slots<> { 27 public sigslot::has_slots<> {
27 public: 28 public:
28 XmppSignalStrategy(JingleThread* thread, 29 XmppSignalStrategy(JingleThread* thread,
29 const std::string& username, 30 const std::string& username,
30 const std::string& auth_token, 31 const std::string& auth_token,
31 const std::string& auth_token_service); 32 const std::string& auth_token_service);
32 virtual ~XmppSignalStrategy(); 33 virtual ~XmppSignalStrategy();
33 34
34 // SignalStrategy interface. 35 // SignalStrategy interface.
35 virtual void Init(StatusObserver* observer) OVERRIDE; 36 virtual void Init(StatusObserver* observer) OVERRIDE;
36 virtual void Close() OVERRIDE; 37 virtual void Close() OVERRIDE;
37 virtual void SetListener(Listener* listener) OVERRIDE; 38 virtual void AddListener(Listener* listener) OVERRIDE;
38 virtual void SendStanza(buzz::XmlElement* stanza) OVERRIDE; 39 virtual void RemoveListener(Listener* listener) OVERRIDE;
40 virtual bool SendStanza(buzz::XmlElement* stanza) OVERRIDE;
39 virtual std::string GetNextId() OVERRIDE; 41 virtual std::string GetNextId() OVERRIDE;
40 virtual IqRequest* CreateIqRequest() OVERRIDE;
41 42
42 // buzz::XmppStanzaHandler interface. 43 // buzz::XmppStanzaHandler interface.
43 virtual bool HandleStanza(const buzz::XmlElement* stanza) OVERRIDE; 44 virtual bool HandleStanza(const buzz::XmlElement* stanza) OVERRIDE;
44 45
45 private: 46 private:
46 void OnConnectionStateChanged(buzz::XmppEngine::State state); 47 void OnConnectionStateChanged(buzz::XmppEngine::State state);
47 static buzz::PreXmppAuth* CreatePreXmppAuth( 48 static buzz::PreXmppAuth* CreatePreXmppAuth(
48 const buzz::XmppClientSettings& settings); 49 const buzz::XmppClientSettings& settings);
49 50
50 JingleThread* thread_; 51 JingleThread* thread_;
51 52
52 std::string username_; 53 std::string username_;
53 std::string auth_token_; 54 std::string auth_token_;
54 std::string auth_token_service_; 55 std::string auth_token_service_;
55 buzz::XmppClient* xmpp_client_; 56 buzz::XmppClient* xmpp_client_;
56 IqRegistry iq_registry_;
57 57
58 StatusObserver* observer_; 58 StatusObserver* observer_;
59 Listener* listener_; 59 std::vector<Listener*> listeners_;
60 60
61 61
62 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy); 62 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy);
63 }; 63 };
64 64
65 } // namespace remoting 65 } // namespace remoting
66 66
67 #endif // REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_ 67 #endif // REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698