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(buzz::STR_GET, buzz::STR_EMPTY, | 37 request_->SendIq(IqRequest::MakeIqStanza( |
38 new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true)); | 38 buzz::STR_GET, buzz::STR_EMPTY, |
| 39 new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true))); |
39 } | 40 } |
40 | 41 |
41 void JingleInfoRequest::OnResponse(const buzz::XmlElement* stanza) { | 42 void JingleInfoRequest::OnResponse(const buzz::XmlElement* stanza) { |
42 const buzz::XmlElement* query = | 43 const buzz::XmlElement* query = |
43 stanza->FirstNamed(buzz::QN_JINGLE_INFO_QUERY); | 44 stanza->FirstNamed(buzz::QN_JINGLE_INFO_QUERY); |
44 if (query == NULL) { | 45 if (query == NULL) { |
45 LOG(WARNING) << "No Jingle info found in Jingle Info query response." | 46 LOG(WARNING) << "No Jingle info found in Jingle Info query response." |
46 << stanza->Str(); | 47 << stanza->Str(); |
47 return; | 48 return; |
48 } | 49 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 stun_hosts_.push_back(address); | 102 stun_hosts_.push_back(address); |
102 | 103 |
103 MessageLoop::current()->DeleteSoon(FROM_HERE, resolver); | 104 MessageLoop::current()->DeleteSoon(FROM_HERE, resolver); |
104 stun_dns_requests_.erase(resolver); | 105 stun_dns_requests_.erase(resolver); |
105 | 106 |
106 if (stun_dns_requests_.empty()) | 107 if (stun_dns_requests_.empty()) |
107 on_jingle_info_cb_.Run(relay_token_, relay_hosts_, stun_hosts_); | 108 on_jingle_info_cb_.Run(relay_token_, relay_hosts_, stun_hosts_); |
108 } | 109 } |
109 | 110 |
110 } // namespace remoting | 111 } // namespace remoting |
OLD | NEW |