| 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/bind.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 base::Unretained(this))); | 27 base::Unretained(this))); |
| 28 } | 28 } |
| 29 | 29 |
| 30 JingleInfoRequest::~JingleInfoRequest() { | 30 JingleInfoRequest::~JingleInfoRequest() { |
| 31 STLDeleteContainerPointers(stun_dns_requests_.begin(), | 31 STLDeleteContainerPointers(stun_dns_requests_.begin(), |
| 32 stun_dns_requests_.end()); | 32 stun_dns_requests_.end()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void JingleInfoRequest::Send(const OnJingleInfoCallback& callback) { | 35 void JingleInfoRequest::Send(const OnJingleInfoCallback& callback) { |
| 36 on_jingle_info_cb_ = callback; | 36 on_jingle_info_cb_ = callback; |
| 37 request_->SendIq(IqRequest::MakeIqStanza( | 37 request_->SendIq(buzz::STR_GET, buzz::STR_EMPTY, |
| 38 buzz::STR_GET, buzz::STR_EMPTY, | 38 new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true)); |
| 39 new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true))); | |
| 40 } | 39 } |
| 41 | 40 |
| 42 void JingleInfoRequest::OnResponse(const buzz::XmlElement* stanza) { | 41 void JingleInfoRequest::OnResponse(const buzz::XmlElement* stanza) { |
| 43 const buzz::XmlElement* query = | 42 const buzz::XmlElement* query = |
| 44 stanza->FirstNamed(buzz::QN_JINGLE_INFO_QUERY); | 43 stanza->FirstNamed(buzz::QN_JINGLE_INFO_QUERY); |
| 45 if (query == NULL) { | 44 if (query == NULL) { |
| 46 LOG(WARNING) << "No Jingle info found in Jingle Info query response." | 45 LOG(WARNING) << "No Jingle info found in Jingle Info query response." |
| 47 << stanza->Str(); | 46 << stanza->Str(); |
| 48 return; | 47 return; |
| 49 } | 48 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 stun_hosts_.push_back(address); | 101 stun_hosts_.push_back(address); |
| 103 | 102 |
| 104 MessageLoop::current()->DeleteSoon(FROM_HERE, resolver); | 103 MessageLoop::current()->DeleteSoon(FROM_HERE, resolver); |
| 105 stun_dns_requests_.erase(resolver); | 104 stun_dns_requests_.erase(resolver); |
| 106 | 105 |
| 107 if (stun_dns_requests_.empty()) | 106 if (stun_dns_requests_.empty()) |
| 108 on_jingle_info_cb_.Run(relay_token_, relay_hosts_, stun_hosts_); | 107 on_jingle_info_cb_.Run(relay_token_, relay_hosts_, stun_hosts_); |
| 109 } | 108 } |
| 110 | 109 |
| 111 } // namespace remoting | 110 } // namespace remoting |
| OLD | NEW |