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 #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_WRITER_IMPL_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_WRITER_IMPL_H_ |
6 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_WRITER_IMPL_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_WRITER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "remoting/host/security_key/remote_security_key_message_writer.h" | |
13 #include "remoting/host/security_key/security_key_message.h" | 12 #include "remoting/host/security_key/security_key_message.h" |
| 13 #include "remoting/host/security_key/security_key_message_writer.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 // Used for sending remote security key messages using a file handle. | 17 // Used for sending security key messages using a file handle. |
18 class RemoteSecurityKeyMessageWriterImpl | 18 class SecurityKeyMessageWriterImpl : public SecurityKeyMessageWriter { |
19 : public RemoteSecurityKeyMessageWriter { | |
20 public: | 19 public: |
21 explicit RemoteSecurityKeyMessageWriterImpl(base::File output_file); | 20 explicit SecurityKeyMessageWriterImpl(base::File output_file); |
22 ~RemoteSecurityKeyMessageWriterImpl() override; | 21 ~SecurityKeyMessageWriterImpl() override; |
23 | 22 |
24 private: | 23 private: |
25 // RemoteSecurityKeyMessageWriter interface. | 24 // SecurityKeyMessageWriter interface. |
26 bool WriteMessage(RemoteSecurityKeyMessageType message_type) override; | 25 bool WriteMessage(SecurityKeyMessageType message_type) override; |
27 bool WriteMessageWithPayload(RemoteSecurityKeyMessageType message_type, | 26 bool WriteMessageWithPayload(SecurityKeyMessageType message_type, |
28 const std::string& message_payload) override; | 27 const std::string& message_payload) override; |
29 | 28 |
30 // Writes |bytes_to_write| bytes from |message| to |output_stream_|. | 29 // Writes |bytes_to_write| bytes from |message| to |output_stream_|. |
31 bool WriteBytesToOutput(const char* message, int bytes_to_write); | 30 bool WriteBytesToOutput(const char* message, int bytes_to_write); |
32 | 31 |
33 base::File output_stream_; | 32 base::File output_stream_; |
34 bool write_failed_ = false; | 33 bool write_failed_ = false; |
35 | 34 |
36 DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageWriterImpl); | 35 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessageWriterImpl); |
37 }; | 36 }; |
38 | 37 |
39 } // namespace remoting | 38 } // namespace remoting |
40 | 39 |
41 #endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_WRITER_IMPL_H_ | 40 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_WRITER_IMPL_H_ |
OLD | NEW |