Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: remoting/host/security_key/security_key_message_handler.h

Issue 2167473003: Revert of Renaming Gnubby and RemoteSecurityKey files/classes/members (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_HANDLER_H_
6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_HANDLER_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/files/file.h"
13 #include "base/macros.h"
14 #include "base/threading/thread_checker.h"
15 #include "remoting/host/security_key/security_key_message.h"
16
17 namespace remoting {
18
19 class SecurityKeyIpcClient;
20 class SecurityKeyMessageReader;
21 class SecurityKeyMessageWriter;
22
23 // Routes security key messages to the client and receives response from
24 // the client and forwards them to the local security key tools.
25 class SecurityKeyMessageHandler {
26 public:
27 SecurityKeyMessageHandler();
28 ~SecurityKeyMessageHandler();
29
30 // Sets up the handler to begin receiving and processing messages.
31 void Start(base::File message_read_stream,
32 base::File message_write_stream,
33 std::unique_ptr<SecurityKeyIpcClient> ipc_client,
34 const base::Closure& error_callback);
35
36 // Sets |reader_| to the instance passed in via |reader|. This method should
37 // be called before Start().
38 void SetSecurityKeyMessageReaderForTest(
39 std::unique_ptr<SecurityKeyMessageReader> reader);
40
41 // Sets |writer_| to the instance passed in via |writer|. This method should
42 // be called before Start().
43 void SetSecurityKeyMessageWriterForTest(
44 std::unique_ptr<SecurityKeyMessageWriter> writer);
45
46 private:
47 // SecurityKeyMessage handler.
48 void ProcessSecurityKeyMessage(std::unique_ptr<SecurityKeyMessage> message);
49
50 // Cleans up resources when an error occurs.
51 void OnError();
52
53 // Writes the passed in message data using |writer_|.
54 void SendMessage(SecurityKeyMessageType message_type);
55 void SendMessageWithPayload(SecurityKeyMessageType message_type,
56 const std::string& message_payload);
57
58 // Used to respond to IPC connection changes.
59 void HandleIpcConnectionChange(bool connection_established);
60
61 // Handles responses received from the client.
62 void HandleSecurityKeyResponse(const std::string& response_data);
63
64 // Handles requests to establich a connection with the Chromoting host.
65 void HandleConnectRequest(const std::string& message_payload);
66
67 // handles security key requests by forwrding them to the client.
68 void HandleSecurityKeyRequest(const std::string& message_payload);
69
70 // Used to communicate with the security key.
71 std::unique_ptr<SecurityKeyIpcClient> ipc_client_;
72
73 // Used to listen for security key messages.
74 std::unique_ptr<SecurityKeyMessageReader> reader_;
75
76 // Used to write security key messages to local security key tools.
77 std::unique_ptr<SecurityKeyMessageWriter> writer_;
78
79 // Signaled when an error occurs.
80 base::Closure error_callback_;
81
82 base::ThreadChecker thread_checker_;
83
84 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessageHandler);
85 };
86
87 } // namespace remoting
88
89 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « remoting/host/security_key/security_key_message.cc ('k') | remoting/host/security_key/security_key_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698