| 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 18 matching lines...) Expand all Loading... |
| 29 const char kSignatureTimeAttr[] = "time"; | 29 const char kSignatureTimeAttr[] = "time"; |
| 30 | 30 |
| 31 // Strings used to parse responses received from the bot. | 31 // Strings used to parse responses received from the bot. |
| 32 const char kRegisterQueryResultTag[] = "register-support-host-result"; | 32 const char kRegisterQueryResultTag[] = "register-support-host-result"; |
| 33 const char kSupportIdTag[] = "support-id"; | 33 const char kSupportIdTag[] = "support-id"; |
| 34 const char kSupportIdLifetimeTag[] = "support-id-lifetime"; | 34 const char kSupportIdLifetimeTag[] = "support-id-lifetime"; |
| 35 } | 35 } |
| 36 | 36 |
| 37 RegisterSupportHostRequest::RegisterSupportHostRequest( | 37 RegisterSupportHostRequest::RegisterSupportHostRequest( |
| 38 SignalStrategy* signal_strategy, | 38 SignalStrategy* signal_strategy, |
| 39 HostKeyPair* key_pair, | 39 protocol::KeyPair* 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_); |
| 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_)); |
| (...skipping 127 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 |