| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_SIGNALING_JINGLE_INFO_REQUEST_H_ | 5 #ifndef REMOTING_SIGNALING_JINGLE_INFO_REQUEST_H_ |
| 6 #define REMOTING_SIGNALING_JINGLE_INFO_REQUEST_H_ | 6 #define REMOTING_SIGNALING_JINGLE_INFO_REQUEST_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "remoting/signaling/iq_sender.h" | 15 #include "remoting/signaling/iq_sender.h" |
| 16 | 16 |
| 17 namespace buzz { | 17 namespace buzz { |
| 18 class XmlElement; | 18 class XmlElement; |
| 19 } // namespace buzz | 19 } // namespace buzz |
| 20 | 20 |
| 21 namespace talk_base { | 21 namespace rtc { |
| 22 class SocketAddress; | 22 class SocketAddress; |
| 23 } // namespace talk_base | 23 } // namespace rtc |
| 24 | 24 |
| 25 namespace remoting { | 25 namespace remoting { |
| 26 | 26 |
| 27 class SignalStrategy; | 27 class SignalStrategy; |
| 28 | 28 |
| 29 // JingleInfoRequest handles requesting STUN/Relay information from | 29 // JingleInfoRequest handles requesting STUN/Relay information from |
| 30 // the Google Talk network. The query is made when Send() is | 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 | 31 // called. The callback given to Send() is called when response to the |
| 32 // request is received. | 32 // request is received. |
| 33 // | 33 // |
| 34 // This class is not threadsafe and should be used on the same thread it is | 34 // This class is not threadsafe and should be used on the same thread it is |
| 35 // created on. | 35 // created on. |
| 36 class JingleInfoRequest { | 36 class JingleInfoRequest { |
| 37 public: | 37 public: |
| 38 // Callback to receive the Jingle configuration settings. All fields are empty | 38 // Callback to receive the Jingle configuration settings. All fields are empty |
| 39 // if the request has timed out. | 39 // if the request has timed out. |
| 40 typedef base::Callback<void(const std::string& relay_token, | 40 typedef base::Callback<void(const std::string& relay_token, |
| 41 const std::vector<std::string>& relay_servers, | 41 const std::vector<std::string>& relay_servers, |
| 42 const std::vector<talk_base::SocketAddress>& | 42 const std::vector<rtc::SocketAddress>& |
| 43 stun_servers)> OnJingleInfoCallback; | 43 stun_servers)> OnJingleInfoCallback; |
| 44 | 44 |
| 45 explicit JingleInfoRequest(SignalStrategy* signal_strategy); | 45 explicit JingleInfoRequest(SignalStrategy* signal_strategy); |
| 46 virtual ~JingleInfoRequest(); | 46 virtual ~JingleInfoRequest(); |
| 47 | 47 |
| 48 void Send(const OnJingleInfoCallback& callback); | 48 void Send(const OnJingleInfoCallback& callback); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 struct PendingDnsRequest; | 51 struct PendingDnsRequest; |
| 52 | 52 |
| 53 void OnResponse(IqRequest* request, const buzz::XmlElement* stanza); | 53 void OnResponse(IqRequest* request, const buzz::XmlElement* stanza); |
| 54 | 54 |
| 55 IqSender iq_sender_; | 55 IqSender iq_sender_; |
| 56 scoped_ptr<IqRequest> request_; | 56 scoped_ptr<IqRequest> request_; |
| 57 OnJingleInfoCallback on_jingle_info_cb_; | 57 OnJingleInfoCallback on_jingle_info_cb_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest); | 59 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace remoting | 62 } // namespace remoting |
| 63 | 63 |
| 64 #endif // REMOTING_SIGNALING_JINGLE_INFO_REQUEST_H_ | 64 #endif // REMOTING_SIGNALING_JINGLE_INFO_REQUEST_H_ |
| OLD | NEW |