Fix build/mac/edit_xibs.sh.
[chromium-blink-merge.git] / remoting / jingle_glue / jingle_info_request.h
blob118aa4a17fc1fd9639e4fcf06f312ce699091583
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"
17 namespace buzz {
18 class XmlElement;
19 } // namespace buzz
21 namespace talk_base {
22 class SocketAddress;
23 } // namespace talk_base
25 namespace remoting {
27 class SignalStrategy;
29 // JingleInfoRequest handles requesting STUN/Relay information from
30 // the Google Talk network. The query is made when Send() is
31 // called. The callback given to Send() is called when response to the
32 // request is received.
34 // This class is not threadsafe and should be used on the same thread it is
35 // created on.
36 class JingleInfoRequest {
37 public:
38 // Callback to receive the Jingle configuration settings. All fields are empty
39 // if the request has timed out.
40 typedef base::Callback<void(const std::string& relay_token,
41 const std::vector<std::string>& relay_servers,
42 const std::vector<talk_base::SocketAddress>&
43 stun_servers)> OnJingleInfoCallback;
45 explicit JingleInfoRequest(SignalStrategy* signal_strategy);
46 virtual ~JingleInfoRequest();
48 void Send(const OnJingleInfoCallback& callback);
50 private:
51 struct PendingDnsRequest;
53 void OnResponse(IqRequest* request, const buzz::XmlElement* stanza);
55 IqSender iq_sender_;
56 scoped_ptr<IqRequest> request_;
57 OnJingleInfoCallback on_jingle_info_cb_;
59 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest);
62 } // namespace remoting
64 #endif // REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_