OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/host/register_support_host_request.h" | 5 #include "remoting/host/register_support_host_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
12 #include "remoting/base/constants.h" | 13 #include "remoting/base/constants.h" |
13 #include "remoting/host/host_config.h" | 14 #include "remoting/host/host_config.h" |
14 #include "remoting/signaling/iq_sender.h" | 15 #include "remoting/signaling/iq_sender.h" |
15 #include "remoting/signaling/signal_strategy.h" | 16 #include "remoting/signaling/signal_strategy.h" |
16 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 17 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
17 #include "third_party/webrtc/libjingle/xmpp/constants.h" | 18 #include "third_party/webrtc/libjingle/xmpp/constants.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 172 } |
172 | 173 |
173 void RegisterSupportHostRequest::CallCallback( | 174 void RegisterSupportHostRequest::CallCallback( |
174 bool success, const std::string& support_id, base::TimeDelta lifetime) { | 175 bool success, const std::string& support_id, base::TimeDelta lifetime) { |
175 // Cleanup state before calling the callback. | 176 // Cleanup state before calling the callback. |
176 request_.reset(); | 177 request_.reset(); |
177 iq_sender_.reset(); | 178 iq_sender_.reset(); |
178 signal_strategy_->RemoveListener(this); | 179 signal_strategy_->RemoveListener(this); |
179 signal_strategy_ = nullptr; | 180 signal_strategy_ = nullptr; |
180 | 181 |
181 RegisterCallback callback = callback_; | 182 base::ResetAndReturn(&callback_).Run(success, support_id, lifetime); |
182 callback_.Reset(); | |
183 callback.Run(success, support_id, lifetime); | |
184 } | 183 } |
185 | 184 |
186 } // namespace remoting | 185 } // namespace remoting |
OLD | NEW |