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_IPC_SERVER_IMPL_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_IMPL_H_ |
6 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_IMPL_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_IMPL_H_ |
7 | 7 |
8 #include "remoting/host/security_key/remote_security_key_ipc_server.h" | 8 #include "remoting/host/security_key/security_key_ipc_server.h" |
9 | 9 |
10 #include <cstdint> | 10 #include <cstdint> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class TimeDelta; | 22 class TimeDelta; |
23 } // base | 23 } // base |
24 | 24 |
25 namespace IPC { | 25 namespace IPC { |
26 class Channel; | 26 class Channel; |
27 class Message; | 27 class Message; |
28 } // IPC | 28 } // IPC |
29 | 29 |
30 namespace remoting { | 30 namespace remoting { |
31 | 31 |
32 // Responsible for handing the server end of the IPC channel between the | 32 // Responsible for handing the server end of the IPC channel between the |
33 // the network process and the local remote_security_key process. | 33 // the network process and the local remote_security_key process. |
34 class RemoteSecurityKeyIpcServerImpl : public RemoteSecurityKeyIpcServer, | 34 class SecurityKeyIpcServerImpl : public SecurityKeyIpcServer, |
35 public IPC::Listener { | 35 public IPC::Listener { |
36 public: | 36 public: |
37 RemoteSecurityKeyIpcServerImpl( | 37 SecurityKeyIpcServerImpl( |
38 int connection_id, | 38 int connection_id, |
39 uint32_t peer_session_id, | 39 uint32_t peer_session_id, |
40 base::TimeDelta initial_connect_timeout, | 40 base::TimeDelta initial_connect_timeout, |
41 const GnubbyAuthHandler::SendMessageCallback& message_callback, | 41 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, |
42 const base::Closure& done_callback); | 42 const base::Closure& done_callback); |
43 ~RemoteSecurityKeyIpcServerImpl() override; | 43 ~SecurityKeyIpcServerImpl() override; |
44 | 44 |
45 // RemoteSecurityKeyIpcServer implementation. | 45 // SecurityKeyIpcServer implementation. |
46 bool CreateChannel(const std::string& channel_name, | 46 bool CreateChannel(const std::string& channel_name, |
47 base::TimeDelta request_timeout) override; | 47 base::TimeDelta request_timeout) override; |
48 bool SendResponse(const std::string& message_data) override; | 48 bool SendResponse(const std::string& message_data) override; |
49 | 49 |
50 private: | 50 private: |
51 // IPC::Listener implementation. | 51 // IPC::Listener implementation. |
52 bool OnMessageReceived(const IPC::Message& message) override; | 52 bool OnMessageReceived(const IPC::Message& message) override; |
53 void OnChannelConnected(int32_t peer_pid) override; | 53 void OnChannelConnected(int32_t peer_pid) override; |
54 void OnChannelError() override; | 54 void OnChannelError() override; |
55 | 55 |
(...skipping 16 matching lines...) Expand all Loading... |
72 // the remote client after a security key request. | 72 // the remote client after a security key request. |
73 base::TimeDelta security_key_request_timeout_; | 73 base::TimeDelta security_key_request_timeout_; |
74 | 74 |
75 // Used to detect timeouts and disconnect the IPC channel. | 75 // Used to detect timeouts and disconnect the IPC channel. |
76 base::OneShotTimer timer_; | 76 base::OneShotTimer timer_; |
77 | 77 |
78 // Used to signal that the IPC channel should be disconnected. | 78 // Used to signal that the IPC channel should be disconnected. |
79 base::Closure done_callback_; | 79 base::Closure done_callback_; |
80 | 80 |
81 // Used to pass a security key request on to the remote client. | 81 // Used to pass a security key request on to the remote client. |
82 GnubbyAuthHandler::SendMessageCallback message_callback_; | 82 SecurityKeyAuthHandler::SendMessageCallback message_callback_; |
83 | 83 |
84 // Used for sending/receiving security key messages between processes. | 84 // Used for sending/receiving security key messages between processes. |
85 std::unique_ptr<IPC::Channel> ipc_channel_; | 85 std::unique_ptr<IPC::Channel> ipc_channel_; |
86 | 86 |
87 // Ensures RemoteSecurityKeyIpcServerImpl methods are called on the same | 87 // Ensures SecurityKeyIpcServerImpl methods are called on the same thread. |
88 // thread. | |
89 base::ThreadChecker thread_checker_; | 88 base::ThreadChecker thread_checker_; |
90 | 89 |
91 base::WeakPtrFactory<RemoteSecurityKeyIpcServerImpl> weak_factory_; | 90 base::WeakPtrFactory<SecurityKeyIpcServerImpl> weak_factory_; |
92 | 91 |
93 DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyIpcServerImpl); | 92 DISALLOW_COPY_AND_ASSIGN(SecurityKeyIpcServerImpl); |
94 }; | 93 }; |
95 | 94 |
96 } // namespace remoting | 95 } // namespace remoting |
97 | 96 |
98 #endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_IMPL_H_ | 97 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_IMPL_H_ |
OLD | NEW |