| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "remoting/jingle_glue/jingle_info_request.h" | 5 #include "remoting/jingle_glue/jingle_info_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" |
| 7 #include "base/task.h" | 8 #include "base/task.h" |
| 8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 9 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 11 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
| 12 #include "remoting/jingle_glue/host_resolver.h" | 13 #include "remoting/jingle_glue/host_resolver.h" |
| 13 #include "remoting/jingle_glue/iq_request.h" | 14 #include "remoting/jingle_glue/iq_request.h" |
| 14 #include "third_party/libjingle/source/talk/base/socketaddress.h" | 15 #include "third_party/libjingle/source/talk/base/socketaddress.h" |
| 15 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 16 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
| 16 #include "third_party/libjingle/source/talk/xmpp/constants.h" | 17 #include "third_party/libjingle/source/talk/xmpp/constants.h" |
| 17 | 18 |
| 18 namespace remoting { | 19 namespace remoting { |
| 19 | 20 |
| 20 | 21 |
| 21 JingleInfoRequest::JingleInfoRequest(IqRequest* request, | 22 JingleInfoRequest::JingleInfoRequest(IqRequest* request, |
| 22 HostResolverFactory* host_resolver_factory) | 23 HostResolverFactory* host_resolver_factory) |
| 23 : host_resolver_factory_(host_resolver_factory), | 24 : host_resolver_factory_(host_resolver_factory), |
| 24 request_(request) { | 25 request_(request) { |
| 25 request_->set_callback(NewCallback(this, &JingleInfoRequest::OnResponse)); | 26 request_->set_callback(base::Bind(&JingleInfoRequest::OnResponse, |
| 27 base::Unretained(this))); |
| 26 } | 28 } |
| 27 | 29 |
| 28 JingleInfoRequest::~JingleInfoRequest() { | 30 JingleInfoRequest::~JingleInfoRequest() { |
| 29 STLDeleteContainerPointers(stun_dns_requests_.begin(), | 31 STLDeleteContainerPointers(stun_dns_requests_.begin(), |
| 30 stun_dns_requests_.end()); | 32 stun_dns_requests_.end()); |
| 31 } | 33 } |
| 32 | 34 |
| 33 void JingleInfoRequest::Send(const OnJingleInfoCallback& callback) { | 35 void JingleInfoRequest::Send(const OnJingleInfoCallback& callback) { |
| 34 on_jingle_info_cb_ = callback; | 36 on_jingle_info_cb_ = callback; |
| 35 request_->SendIq(buzz::STR_GET, buzz::STR_EMPTY, | 37 request_->SendIq(buzz::STR_GET, buzz::STR_EMPTY, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 stun_hosts_.push_back(address); | 101 stun_hosts_.push_back(address); |
| 100 | 102 |
| 101 MessageLoop::current()->DeleteSoon(FROM_HERE, resolver); | 103 MessageLoop::current()->DeleteSoon(FROM_HERE, resolver); |
| 102 stun_dns_requests_.erase(resolver); | 104 stun_dns_requests_.erase(resolver); |
| 103 | 105 |
| 104 if (stun_dns_requests_.empty()) | 106 if (stun_dns_requests_.empty()) |
| 105 on_jingle_info_cb_.Run(relay_token_, relay_hosts_, stun_hosts_); | 107 on_jingle_info_cb_.Run(relay_token_, relay_hosts_, stun_hosts_); |
| 106 } | 108 } |
| 107 | 109 |
| 108 } // namespace remoting | 110 } // namespace remoting |
| OLD | NEW |