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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 RegisterSupportHostRequest::RegisterSupportHostRequest( | 37 RegisterSupportHostRequest::RegisterSupportHostRequest( |
38 SignalStrategy* signal_strategy, | 38 SignalStrategy* signal_strategy, |
39 scoped_refptr<RsaKeyPair> key_pair, | 39 scoped_refptr<RsaKeyPair> key_pair, |
40 const std::string& directory_bot_jid, | 40 const std::string& directory_bot_jid, |
41 const RegisterCallback& callback) | 41 const RegisterCallback& callback) |
42 : signal_strategy_(signal_strategy), | 42 : signal_strategy_(signal_strategy), |
43 key_pair_(key_pair), | 43 key_pair_(key_pair), |
44 directory_bot_jid_(directory_bot_jid), | 44 directory_bot_jid_(directory_bot_jid), |
45 callback_(callback) { | 45 callback_(callback) { |
46 DCHECK(signal_strategy_); | 46 DCHECK(signal_strategy_); |
47 DCHECK(key_pair_); | 47 DCHECK(key_pair_.get()); |
48 signal_strategy_->AddListener(this); | 48 signal_strategy_->AddListener(this); |
49 iq_sender_.reset(new IqSender(signal_strategy_)); | 49 iq_sender_.reset(new IqSender(signal_strategy_)); |
50 } | 50 } |
51 | 51 |
52 RegisterSupportHostRequest::~RegisterSupportHostRequest() { | 52 RegisterSupportHostRequest::~RegisterSupportHostRequest() { |
53 if (signal_strategy_) | 53 if (signal_strategy_) |
54 signal_strategy_->RemoveListener(this); | 54 signal_strategy_->RemoveListener(this); |
55 } | 55 } |
56 | 56 |
57 void RegisterSupportHostRequest::OnSignalStrategyStateChange( | 57 void RegisterSupportHostRequest::OnSignalStrategyStateChange( |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 iq_sender_.reset(); | 177 iq_sender_.reset(); |
178 signal_strategy_->RemoveListener(this); | 178 signal_strategy_->RemoveListener(this); |
179 signal_strategy_ = NULL; | 179 signal_strategy_ = NULL; |
180 | 180 |
181 RegisterCallback callback = callback_; | 181 RegisterCallback callback = callback_; |
182 callback_.Reset(); | 182 callback_.Reset(); |
183 callback.Run(success, support_id, lifetime); | 183 callback.Run(success, support_id, lifetime); |
184 } | 184 } |
185 | 185 |
186 } // namespace remoting | 186 } // namespace remoting |
OLD | NEW |