OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/protocol/jingle_info_request.h" | 5 #include "remoting/protocol/jingle_info_request.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // Get fresh STUN/Relay configuration every hour. | 25 // Get fresh STUN/Relay configuration every hour. |
26 static const int kJingleInfoUpdatePeriodSeconds = 3600; | 26 static const int kJingleInfoUpdatePeriodSeconds = 3600; |
27 | 27 |
28 JingleInfoRequest::JingleInfoRequest(SignalStrategy* signal_strategy) | 28 JingleInfoRequest::JingleInfoRequest(SignalStrategy* signal_strategy) |
29 : iq_sender_(signal_strategy) {} | 29 : iq_sender_(signal_strategy) {} |
30 | 30 |
31 JingleInfoRequest::~JingleInfoRequest() {} | 31 JingleInfoRequest::~JingleInfoRequest() {} |
32 | 32 |
33 void JingleInfoRequest::Send(const OnIceConfigCallback& callback) { | 33 void JingleInfoRequest::Send(const OnIceConfigCallback& callback) { |
34 on_ice_config_callback_ = callback; | 34 on_ice_config_callback_ = callback; |
35 scoped_ptr<buzz::XmlElement> iq_body( | 35 std::unique_ptr<buzz::XmlElement> iq_body( |
36 new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true)); | 36 new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true)); |
37 request_ = iq_sender_.SendIq( | 37 request_ = iq_sender_.SendIq( |
38 buzz::STR_GET, buzz::STR_EMPTY, std::move(iq_body), | 38 buzz::STR_GET, buzz::STR_EMPTY, std::move(iq_body), |
39 base::Bind(&JingleInfoRequest::OnResponse, base::Unretained(this))); | 39 base::Bind(&JingleInfoRequest::OnResponse, base::Unretained(this))); |
40 if (!request_) { | 40 if (!request_) { |
41 // If we failed to send IqRequest it means that SignalStrategy is | 41 // If we failed to send IqRequest it means that SignalStrategy is |
42 // disconnected. Notify the caller. | 42 // disconnected. Notify the caller. |
43 IceConfig config; | 43 IceConfig config; |
44 on_ice_config_callback_.Run(config); | 44 on_ice_config_callback_.Run(config); |
45 return; | 45 return; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 result.expiration_time = | 102 result.expiration_time = |
103 base::Time::Now() + | 103 base::Time::Now() + |
104 base::TimeDelta::FromSeconds(kJingleInfoUpdatePeriodSeconds); | 104 base::TimeDelta::FromSeconds(kJingleInfoUpdatePeriodSeconds); |
105 | 105 |
106 on_ice_config_callback_.Run(result); | 106 on_ice_config_callback_.Run(result); |
107 } | 107 } |
108 | 108 |
109 } // namespace protocol | 109 } // namespace protocol |
110 } // namespace remoting | 110 } // namespace remoting |
OLD | NEW |