| 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/protocol/v2_authenticator.h" | 5 #include "remoting/protocol/v2_authenticator.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
| 10 #include "remoting/protocol/ssl_hmac_channel_authenticator.h" | 10 #include "remoting/protocol/ssl_hmac_channel_authenticator.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if (state_ == ACCEPTED && !pending_messages_.empty()) | 72 if (state_ == ACCEPTED && !pending_messages_.empty()) |
| 73 return MESSAGE_READY; | 73 return MESSAGE_READY; |
| 74 return state_; | 74 return state_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 Authenticator::RejectionReason V2Authenticator::rejection_reason() const { | 77 Authenticator::RejectionReason V2Authenticator::rejection_reason() const { |
| 78 DCHECK_EQ(state(), REJECTED); | 78 DCHECK_EQ(state(), REJECTED); |
| 79 return rejection_reason_; | 79 return rejection_reason_; |
| 80 } | 80 } |
| 81 | 81 |
| 82 void V2Authenticator::ProcessMessage(const buzz::XmlElement* message) { | 82 void V2Authenticator::ProcessMessage(const base::Closure& resume_callback, |
| 83 const buzz::XmlElement* message) { |
| 84 ProcessMessageInternal(message); |
| 85 resume_callback.Run(); |
| 86 } |
| 87 |
| 88 void V2Authenticator::ProcessMessageInternal(const buzz::XmlElement* message) { |
| 83 DCHECK_EQ(state(), WAITING_MESSAGE); | 89 DCHECK_EQ(state(), WAITING_MESSAGE); |
| 84 | 90 |
| 85 // Parse the certificate. | 91 // Parse the certificate. |
| 86 std::string base64_cert = message->TextNamed(kCertificateTag); | 92 std::string base64_cert = message->TextNamed(kCertificateTag); |
| 87 if (!base64_cert.empty()) { | 93 if (!base64_cert.empty()) { |
| 88 if (!base::Base64Decode(base64_cert, &remote_cert_)) { | 94 if (!base::Base64Decode(base64_cert, &remote_cert_)) { |
| 89 LOG(WARNING) << "Failed to decode certificate received from the peer."; | 95 LOG(WARNING) << "Failed to decode certificate received from the peer."; |
| 90 remote_cert_.clear(); | 96 remote_cert_.clear(); |
| 91 } | 97 } |
| 92 } | 98 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 remote_cert_, auth_key_).Pass()); | 199 remote_cert_, auth_key_).Pass()); |
| 194 } | 200 } |
| 195 } | 201 } |
| 196 | 202 |
| 197 bool V2Authenticator::is_host_side() const { | 203 bool V2Authenticator::is_host_side() const { |
| 198 return local_key_pair_.get() != NULL; | 204 return local_key_pair_.get() != NULL; |
| 199 } | 205 } |
| 200 | 206 |
| 201 } // namespace protocol | 207 } // namespace protocol |
| 202 } // namespace remoting | 208 } // namespace remoting |
| OLD | NEW |