| 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 <stdint.h> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 11 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 13 #include "remoting/base/constants.h" | 15 #include "remoting/base/constants.h" |
| 14 #include "remoting/host/host_config.h" | 16 #include "remoting/host/host_config.h" |
| 15 #include "remoting/signaling/iq_sender.h" | 17 #include "remoting/signaling/iq_sender.h" |
| 16 #include "remoting/signaling/jid_util.h" | 18 #include "remoting/signaling/jid_util.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 query->AddElement(public_key); | 91 query->AddElement(public_key); |
| 90 query->AddElement(CreateSignature(jid).release()); | 92 query->AddElement(CreateSignature(jid).release()); |
| 91 return query.Pass(); | 93 return query.Pass(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 scoped_ptr<XmlElement> RegisterSupportHostRequest::CreateSignature( | 96 scoped_ptr<XmlElement> RegisterSupportHostRequest::CreateSignature( |
| 95 const std::string& jid) { | 97 const std::string& jid) { |
| 96 scoped_ptr<XmlElement> signature_tag(new XmlElement( | 98 scoped_ptr<XmlElement> signature_tag(new XmlElement( |
| 97 QName(kChromotingXmlNamespace, kSignatureTag))); | 99 QName(kChromotingXmlNamespace, kSignatureTag))); |
| 98 | 100 |
| 99 int64 time = static_cast<int64>(base::Time::Now().ToDoubleT()); | 101 int64_t time = static_cast<int64_t>(base::Time::Now().ToDoubleT()); |
| 100 std::string time_str(base::Int64ToString(time)); | 102 std::string time_str(base::Int64ToString(time)); |
| 101 signature_tag->AddAttr( | 103 signature_tag->AddAttr( |
| 102 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); | 104 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); |
| 103 | 105 |
| 104 std::string message = NormalizeJid(jid) + ' ' + time_str; | 106 std::string message = NormalizeJid(jid) + ' ' + time_str; |
| 105 std::string signature(key_pair_->SignMessage(message)); | 107 std::string signature(key_pair_->SignMessage(message)); |
| 106 signature_tag->AddText(signature); | 108 signature_tag->AddText(signature); |
| 107 | 109 |
| 108 return signature_tag.Pass(); | 110 return signature_tag.Pass(); |
| 109 } | 111 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // Cleanup state before calling the callback. | 198 // Cleanup state before calling the callback. |
| 197 request_.reset(); | 199 request_.reset(); |
| 198 iq_sender_.reset(); | 200 iq_sender_.reset(); |
| 199 signal_strategy_->RemoveListener(this); | 201 signal_strategy_->RemoveListener(this); |
| 200 signal_strategy_ = nullptr; | 202 signal_strategy_ = nullptr; |
| 201 | 203 |
| 202 base::ResetAndReturn(&callback_).Run(support_id, lifetime, error_message); | 204 base::ResetAndReturn(&callback_).Run(support_id, lifetime, error_message); |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace remoting | 207 } // namespace remoting |
| OLD | NEW |