Only sync parent directory once after a leveldb file rename.
[chromium-blink-merge.git] / remoting / jingle_glue / jingle_info_request.h
bloba1b10dead931f959bc75d5554e048f5d83dd222e
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_
6 #define REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/callback.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "remoting/jingle_glue/iq_sender.h"
16 #include "third_party/libjingle/source/talk/base/sigslot.h"
18 namespace buzz {
19 class XmlElement;
20 } // namespace buzz
22 namespace talk_base {
23 class SocketAddress;
24 } // namespace talk_base
26 namespace remoting {
28 class SignalStrategy;
30 // JingleInfoRequest handles requesting STUN/Relay information from
31 // the Google Talk network. The query is made when Send() is
32 // called. The callback given to Send() is called when response to the
33 // request is received.
35 // This class is not threadsafe and should be used on the same thread it is
36 // created on.
38 // TODO(ajwong): Add support for a timeout.
39 class JingleInfoRequest : public sigslot::has_slots<> {
40 public:
41 // Callback to receive the Jingle configuration settings. The arguments are
42 // passed by pointer so the receive may call swap on them. The receiver does
43 // NOT own the arguments, which are guaranteed only to be alive for the
44 // duration of the callback.
45 typedef base::Callback<void (
46 const std::string&, const std::vector<std::string>&,
47 const std::vector<talk_base::SocketAddress>&)> OnJingleInfoCallback;
49 explicit JingleInfoRequest(SignalStrategy* signal_strategy);
50 virtual ~JingleInfoRequest();
52 void Send(const OnJingleInfoCallback& callback);
54 private:
55 struct PendingDnsRequest;
57 void OnResponse(IqRequest* request, const buzz::XmlElement* stanza);
59 IqSender iq_sender_;
60 scoped_ptr<IqRequest> request_;
61 OnJingleInfoCallback on_jingle_info_cb_;
63 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest);
66 } // namespace remoting
68 #endif // REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_