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

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

Issue 2085353004: Update GnubbyAuthHandler to use the current session ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host_extension
Patch Set: Fixing a build break 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
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_REMOTE_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_REMOTE_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/remote_security_key_ipc_server.h"
9 9
10 #include <cstdint>
10 #include <memory> 11 #include <memory>
11 #include <string> 12 #include <string>
12 13
13 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
15 #include "base/time/time.h" 17 #include "base/time/time.h"
16 #include "base/timer/timer.h" 18 #include "base/timer/timer.h"
17 #include "ipc/ipc_listener.h" 19 #include "ipc/ipc_listener.h"
18 20
19 namespace base { 21 namespace base {
20 class TimeDelta; 22 class TimeDelta;
21 } // base 23 } // base
22 24
23 namespace IPC { 25 namespace IPC {
24 class Channel; 26 class Channel;
25 class Message; 27 class Message;
26 } // IPC 28 } // IPC
27 29
28 namespace remoting { 30 namespace remoting {
29 31
30 // 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
31 // the network process and the local remote_security_key process. 33 // the network process and the local remote_security_key process.
32 class RemoteSecurityKeyIpcServerImpl : public RemoteSecurityKeyIpcServer, 34 class RemoteSecurityKeyIpcServerImpl : public RemoteSecurityKeyIpcServer,
33 public IPC::Listener { 35 public IPC::Listener {
34 public: 36 public:
35 RemoteSecurityKeyIpcServerImpl( 37 RemoteSecurityKeyIpcServerImpl(
36 int connection_id, 38 int connection_id,
39 uint32_t peer_session_id,
37 base::TimeDelta initial_connect_timeout, 40 base::TimeDelta initial_connect_timeout,
38 const GnubbyAuthHandler::SendMessageCallback& message_callback, 41 const GnubbyAuthHandler::SendMessageCallback& message_callback,
39 const base::Closure& done_callback); 42 const base::Closure& done_callback);
40 ~RemoteSecurityKeyIpcServerImpl() override; 43 ~RemoteSecurityKeyIpcServerImpl() override;
41 44
42 // RemoteSecurityKeyIpcServer implementation. 45 // RemoteSecurityKeyIpcServer implementation.
43 bool CreateChannel(const std::string& channel_name, 46 bool CreateChannel(const std::string& channel_name,
44 base::TimeDelta request_timeout) override; 47 base::TimeDelta request_timeout) override;
45 bool SendResponse(const std::string& message_data) override; 48 bool SendResponse(const std::string& message_data) override;
46 49
47 private: 50 private:
48 // IPC::Listener implementation. 51 // IPC::Listener implementation.
49 bool OnMessageReceived(const IPC::Message& message) override; 52 bool OnMessageReceived(const IPC::Message& message) override;
50 void OnChannelConnected(int32_t peer_pid) override; 53 void OnChannelConnected(int32_t peer_pid) override;
51 void OnChannelError() override; 54 void OnChannelError() override;
52 55
53 // Handles security key resquest IPC messages. 56 // Handles security key resquest IPC messages.
54 void OnSecurityKeyRequest(const std::string& request); 57 void OnSecurityKeyRequest(const std::string& request);
55 58
56 // The value assigned to identify the current IPC channel. 59 // The value assigned to identify the current IPC channel.
57 int connection_id_; 60 int connection_id_;
58 61
62 // The expected session id of the process connecting to the IPC channel.
63 uint32_t peer_session_id_;
64
59 // Timeout for disconnecting the IPC channel if there is no client activity. 65 // Timeout for disconnecting the IPC channel if there is no client activity.
60 base::TimeDelta initial_connect_timeout_; 66 base::TimeDelta initial_connect_timeout_;
61 67
62 // Timeout for disconnecting the IPC channel if there is no response from 68 // Timeout for disconnecting the IPC channel if there is no response from
63 // the remote client after a security key request. 69 // the remote client after a security key request.
64 base::TimeDelta security_key_request_timeout_; 70 base::TimeDelta security_key_request_timeout_;
65 71
66 // Used to detect timeouts and disconnect the IPC channel. 72 // Used to detect timeouts and disconnect the IPC channel.
67 base::OneShotTimer timer_; 73 base::OneShotTimer timer_;
68 74
69 // Used to signal that the IPC channel should be disconnected. 75 // Used to signal that the IPC channel should be disconnected.
70 base::Closure done_callback_; 76 base::Closure done_callback_;
71 77
72 // Used to pass a security key request on to the remote client. 78 // Used to pass a security key request on to the remote client.
73 GnubbyAuthHandler::SendMessageCallback message_callback_; 79 GnubbyAuthHandler::SendMessageCallback message_callback_;
74 80
75 // Used for sending/receiving security key messages between processes. 81 // Used for sending/receiving security key messages between processes.
76 std::unique_ptr<IPC::Channel> ipc_channel_; 82 std::unique_ptr<IPC::Channel> ipc_channel_;
77 83
78 // Ensures RemoteSecurityKeyIpcServerImpl methods are called on the same 84 // Ensures RemoteSecurityKeyIpcServerImpl methods are called on the same
79 // thread. 85 // thread.
80 base::ThreadChecker thread_checker_; 86 base::ThreadChecker thread_checker_;
81 87
88 base::WeakPtrFactory<RemoteSecurityKeyIpcServerImpl> weak_factory_;
89
82 DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyIpcServerImpl); 90 DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyIpcServerImpl);
83 }; 91 };
84 92
85 } // namespace remoting 93 } // namespace remoting
86 94
87 #endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_IMPL_H_ 95 #endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698