| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/security_key/security_key_message_reader_impl.h" | 5 #include "remoting/host/security_key/security_key_message_reader_impl.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 if (!SecurityKeyMessage::IsValidMessageSize(message_length_bytes)) { | 73 if (!SecurityKeyMessage::IsValidMessageSize(message_length_bytes)) { |
| 74 LOG(ERROR) << "Message size is invalid: " << message_length_bytes; | 74 LOG(ERROR) << "Message size is invalid: " << message_length_bytes; |
| 75 NotifyError(); | 75 NotifyError(); |
| 76 return; | 76 return; |
| 77 } | 77 } |
| 78 | 78 |
| 79 std::string message_data(message_length_bytes, '\0'); | 79 std::string message_data(message_length_bytes, '\0'); |
| 80 if (!ReadFromStream(string_as_array(&message_data), message_data.size())) { | 80 if (!ReadFromStream(base::string_as_array(&message_data), |
| 81 message_data.size())) { |
| 81 NotifyError(); | 82 NotifyError(); |
| 82 return; | 83 return; |
| 83 } | 84 } |
| 84 | 85 |
| 85 std::unique_ptr<SecurityKeyMessage> message(new SecurityKeyMessage()); | 86 std::unique_ptr<SecurityKeyMessage> message(new SecurityKeyMessage()); |
| 86 if (!message->ParseMessage(message_data)) { | 87 if (!message->ParseMessage(message_data)) { |
| 87 LOG(ERROR) << "Invalid message data received."; | 88 LOG(ERROR) << "Invalid message data received."; |
| 88 NotifyError(); | 89 NotifyError(); |
| 89 return; | 90 return; |
| 90 } | 91 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 DCHECK(main_task_runner_->RunsTasksOnCurrentThread()); | 135 DCHECK(main_task_runner_->RunsTasksOnCurrentThread()); |
| 135 message_callback_.Run(std::move(message)); | 136 message_callback_.Run(std::move(message)); |
| 136 } | 137 } |
| 137 | 138 |
| 138 void SecurityKeyMessageReaderImpl::InvokeErrorCallback() { | 139 void SecurityKeyMessageReaderImpl::InvokeErrorCallback() { |
| 139 DCHECK(main_task_runner_->RunsTasksOnCurrentThread()); | 140 DCHECK(main_task_runner_->RunsTasksOnCurrentThread()); |
| 140 error_callback_.Run(); | 141 error_callback_.Run(); |
| 141 } | 142 } |
| 142 | 143 |
| 143 } // namespace remoting | 144 } // namespace remoting |
| OLD | NEW |