Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / remoting / signaling / jingle_info_request.h
blobcfe9959a9925396764cbc6c0aedf8ba2a43a3041
1 // Copyright 2014 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_SIGNALING_JINGLE_INFO_REQUEST_H_
6 #define REMOTING_SIGNALING_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/signaling/iq_sender.h"
17 namespace buzz {
18 class XmlElement;
19 } // namespace buzz
21 namespace rtc {
22 class SocketAddress;
23 } // namespace rtc
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<rtc::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_SIGNALING_JINGLE_INFO_REQUEST_H_