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_SECURITY_KEY_MESSAGE_HANDLER_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_HANDLER_H_ |
6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_HANDLER_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void OnError(); | 51 void OnError(); |
52 | 52 |
53 // Writes the passed in message data using |writer_|. | 53 // Writes the passed in message data using |writer_|. |
54 void SendMessage(SecurityKeyMessageType message_type); | 54 void SendMessage(SecurityKeyMessageType message_type); |
55 void SendMessageWithPayload(SecurityKeyMessageType message_type, | 55 void SendMessageWithPayload(SecurityKeyMessageType message_type, |
56 const std::string& message_payload); | 56 const std::string& message_payload); |
57 | 57 |
58 // Used to respond to IPC connection changes. | 58 // Used to respond to IPC connection changes. |
59 void HandleIpcConnectionChange(bool connection_established); | 59 void HandleIpcConnectionChange(bool connection_established); |
60 | 60 |
| 61 // Used to indicate an IPC connection error has occurred. |
| 62 void HandleIpcConnectionError(); |
| 63 |
61 // Handles responses received from the client. | 64 // Handles responses received from the client. |
62 void HandleSecurityKeyResponse(const std::string& response_data); | 65 void HandleSecurityKeyResponse(const std::string& response_data); |
63 | 66 |
64 // Handles requests to establich a connection with the Chromoting host. | 67 // Handles requests to establich a connection with the Chromoting host. |
65 void HandleConnectRequest(const std::string& message_payload); | 68 void HandleConnectRequest(const std::string& message_payload); |
66 | 69 |
67 // handles security key requests by forwrding them to the client. | 70 // handles security key requests by forwrding them to the client. |
68 void HandleSecurityKeyRequest(const std::string& message_payload); | 71 void HandleSecurityKeyRequest(const std::string& message_payload); |
69 | 72 |
70 // Used to communicate with the security key. | 73 // Used to communicate with the security key. |
71 std::unique_ptr<SecurityKeyIpcClient> ipc_client_; | 74 std::unique_ptr<SecurityKeyIpcClient> ipc_client_; |
72 | 75 |
73 // Used to listen for security key messages. | 76 // Used to listen for security key messages. |
74 std::unique_ptr<SecurityKeyMessageReader> reader_; | 77 std::unique_ptr<SecurityKeyMessageReader> reader_; |
75 | 78 |
76 // Used to write security key messages to local security key tools. | 79 // Used to write security key messages to local security key tools. |
77 std::unique_ptr<SecurityKeyMessageWriter> writer_; | 80 std::unique_ptr<SecurityKeyMessageWriter> writer_; |
78 | 81 |
79 // Signaled when an error occurs. | 82 // Signaled when an error occurs. |
80 base::Closure error_callback_; | 83 base::Closure error_callback_; |
81 | 84 |
| 85 // Used to indicate when we expect the IPC channel to be closed (i.e. in the |
| 86 // invalid session scenario) and when it is an unexpected error. |
| 87 bool expect_ipc_channel_close_ = false; |
| 88 |
82 base::ThreadChecker thread_checker_; | 89 base::ThreadChecker thread_checker_; |
83 | 90 |
84 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessageHandler); | 91 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessageHandler); |
85 }; | 92 }; |
86 | 93 |
87 } // namespace remoting | 94 } // namespace remoting |
88 | 95 |
89 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_HANDLER_H_ | 96 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_HANDLER_H_ |
OLD | NEW |