| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_ | |
| 6 #define REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 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 | |
| 17 namespace buzz { | |
| 18 class XmlElement; | |
| 19 } // namespace buzz | |
| 20 | |
| 21 namespace talk_base { | |
| 22 class SocketAddress; | |
| 23 } // namespace talk_base | |
| 24 | |
| 25 namespace remoting { | |
| 26 | |
| 27 class SignalStrategy; | |
| 28 | |
| 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. | |
| 33 // | |
| 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; | |
| 44 | |
| 45 explicit JingleInfoRequest(SignalStrategy* signal_strategy); | |
| 46 virtual ~JingleInfoRequest(); | |
| 47 | |
| 48 void Send(const OnJingleInfoCallback& callback); | |
| 49 | |
| 50 private: | |
| 51 struct PendingDnsRequest; | |
| 52 | |
| 53 void OnResponse(IqRequest* request, const buzz::XmlElement* stanza); | |
| 54 | |
| 55 IqSender iq_sender_; | |
| 56 scoped_ptr<IqRequest> request_; | |
| 57 OnJingleInfoCallback on_jingle_info_cb_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest); | |
| 60 }; | |
| 61 | |
| 62 } // namespace remoting | |
| 63 | |
| 64 #endif // REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_ | |
| OLD | NEW |