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 #ifndef REMOTING_JINGLE_GLUE_XMPP_IQ_REQUEST_H_ | 5 #ifndef REMOTING_JINGLE_GLUE_XMPP_IQ_REQUEST_H_ |
6 #define REMOTING_JINGLE_GLUE_XMPP_IQ_REQUEST_H_ | 6 #define REMOTING_JINGLE_GLUE_XMPP_IQ_REQUEST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "remoting/jingle_glue/iq_request.h" | 9 #include "remoting/jingle_glue/iq_request.h" |
10 #include "third_party/libjingle/source/talk/base/sigslot.h" | 10 #include "third_party/libjingle/source/talk/base/sigslot.h" |
11 #include "third_party/libjingle/source/talk/xmpp/xmppengine.h" | 11 #include "third_party/libjingle/source/talk/xmpp/xmppengine.h" |
12 | 12 |
13 class MessageLoop; | 13 class MessageLoop; |
14 | 14 |
15 namespace buzz { | 15 namespace buzz { |
16 class XmppClient; | 16 class XmppClient; |
17 } // namespace buzz | 17 } // namespace buzz |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 | 20 |
21 class XmppIqRequest : public IqRequest, public buzz::XmppIqHandler { | 21 class XmppIqRequest : public IqRequest, public buzz::XmppIqHandler { |
22 public: | 22 public: |
23 typedef Callback1<const buzz::XmlElement*>::Type ReplyCallback; | |
24 | |
25 XmppIqRequest(MessageLoop* message_loop, buzz::XmppClient* xmpp_client); | 23 XmppIqRequest(MessageLoop* message_loop, buzz::XmppClient* xmpp_client); |
26 virtual ~XmppIqRequest(); | 24 virtual ~XmppIqRequest(); |
27 | 25 |
28 // IqRequest interface. | 26 // IqRequest interface. |
29 virtual void SendIq(const std::string& type, const std::string& addressee, | 27 virtual void SendIq(const std::string& type, const std::string& addressee, |
30 buzz::XmlElement* iq_body) OVERRIDE; | 28 buzz::XmlElement* iq_body) OVERRIDE; |
31 virtual void set_callback(ReplyCallback* callback) OVERRIDE; | 29 virtual void set_callback(const ReplyCallback& callback) OVERRIDE; |
32 | 30 |
33 // buzz::XmppIqHandler interface. | 31 // buzz::XmppIqHandler interface. |
34 virtual void IqResponse(buzz::XmppIqCookie cookie, | 32 virtual void IqResponse(buzz::XmppIqCookie cookie, |
35 const buzz::XmlElement* stanza) OVERRIDE; | 33 const buzz::XmlElement* stanza) OVERRIDE; |
36 | 34 |
37 private: | 35 private: |
38 FRIEND_TEST_ALL_PREFIXES(IqRequestTest, MakeIqStanza); | 36 FRIEND_TEST_ALL_PREFIXES(IqRequestTest, MakeIqStanza); |
39 | 37 |
40 void Unregister(); | 38 void Unregister(); |
41 | 39 |
42 // TODO(ajwong): This used to hold a reference to the jingle client...make | 40 // TODO(ajwong): This used to hold a reference to the jingle client...make |
43 // sure the lifetime names sense now. | 41 // sure the lifetime names sense now. |
44 MessageLoop* message_loop_; | 42 MessageLoop* message_loop_; |
45 buzz::XmppClient* xmpp_client_; | 43 buzz::XmppClient* xmpp_client_; |
46 buzz::XmppIqCookie cookie_; | 44 buzz::XmppIqCookie cookie_; |
47 scoped_ptr<ReplyCallback> callback_; | 45 ReplyCallback callback_; |
48 }; | 46 }; |
49 | 47 |
50 } // namespace remoting | 48 } // namespace remoting |
51 | 49 |
52 #endif // REMOTING_JINGLE_GLUE_XMPP_IQ_REQUEST_H_ | 50 #endif // REMOTING_JINGLE_GLUE_XMPP_IQ_REQUEST_H_ |
OLD | NEW |