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

Side by Side Diff: remoting/host/win/unprivileged_process_delegate.h

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ 5 #ifndef REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_
6 #define REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ 6 #define REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
11
10 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/threading/non_thread_safe.h" 16 #include "base/threading/non_thread_safe.h"
16 #include "base/win/scoped_handle.h" 17 #include "base/win/scoped_handle.h"
17 #include "ipc/ipc_listener.h" 18 #include "ipc/ipc_listener.h"
18 #include "remoting/host/win/worker_process_launcher.h" 19 #include "remoting/host/win/worker_process_launcher.h"
19 20
20 namespace base { 21 namespace base {
21 class CommandLine; 22 class CommandLine;
22 class SingleThreadTaskRunner; 23 class SingleThreadTaskRunner;
23 } // namespace base 24 } // namespace base
24 25
25 namespace IPC { 26 namespace IPC {
26 class ChannelProxy; 27 class ChannelProxy;
27 class Message; 28 class Message;
28 } // namespace IPC 29 } // namespace IPC
29 30
30 namespace remoting { 31 namespace remoting {
31 32
32 // Implements logic for launching and monitoring a worker process under a less 33 // Implements logic for launching and monitoring a worker process under a less
33 // privileged user account. 34 // privileged user account.
34 class UnprivilegedProcessDelegate 35 class UnprivilegedProcessDelegate
35 : public base::NonThreadSafe, 36 : public base::NonThreadSafe,
36 public IPC::Listener, 37 public IPC::Listener,
37 public WorkerProcessLauncher::Delegate { 38 public WorkerProcessLauncher::Delegate {
38 public: 39 public:
39 UnprivilegedProcessDelegate( 40 UnprivilegedProcessDelegate(
40 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 41 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
41 scoped_ptr<base::CommandLine> target_command); 42 std::unique_ptr<base::CommandLine> target_command);
42 ~UnprivilegedProcessDelegate() override; 43 ~UnprivilegedProcessDelegate() override;
43 44
44 // WorkerProcessLauncher::Delegate implementation. 45 // WorkerProcessLauncher::Delegate implementation.
45 void LaunchProcess(WorkerProcessLauncher* event_handler) override; 46 void LaunchProcess(WorkerProcessLauncher* event_handler) override;
46 void Send(IPC::Message* message) override; 47 void Send(IPC::Message* message) override;
47 void CloseChannel() override; 48 void CloseChannel() override;
48 void KillProcess() override; 49 void KillProcess() override;
49 50
50 private: 51 private:
51 // IPC::Listener implementation. 52 // IPC::Listener implementation.
52 bool OnMessageReceived(const IPC::Message& message) override; 53 bool OnMessageReceived(const IPC::Message& message) override;
53 void OnChannelConnected(int32_t peer_pid) override; 54 void OnChannelConnected(int32_t peer_pid) override;
54 void OnChannelError() override; 55 void OnChannelError() override;
55 56
56 void ReportFatalError(); 57 void ReportFatalError();
57 void ReportProcessLaunched(base::win::ScopedHandle worker_process); 58 void ReportProcessLaunched(base::win::ScopedHandle worker_process);
58 59
59 // The task runner serving job object notifications. 60 // The task runner serving job object notifications.
60 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 61 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
61 62
62 // Command line of the launched process. 63 // Command line of the launched process.
63 scoped_ptr<base::CommandLine> target_command_; 64 std::unique_ptr<base::CommandLine> target_command_;
64 65
65 // The server end of the IPC channel used to communicate to the worker 66 // The server end of the IPC channel used to communicate to the worker
66 // process. 67 // process.
67 scoped_ptr<IPC::ChannelProxy> channel_; 68 std::unique_ptr<IPC::ChannelProxy> channel_;
68 69
69 WorkerProcessLauncher* event_handler_; 70 WorkerProcessLauncher* event_handler_;
70 71
71 // The handle of the worker process, if launched. 72 // The handle of the worker process, if launched.
72 base::win::ScopedHandle worker_process_; 73 base::win::ScopedHandle worker_process_;
73 74
74 DISALLOW_COPY_AND_ASSIGN(UnprivilegedProcessDelegate); 75 DISALLOW_COPY_AND_ASSIGN(UnprivilegedProcessDelegate);
75 }; 76 };
76 77
77 } // namespace remoting 78 } // namespace remoting
78 79
79 #endif // REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ 80 #endif // REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_
OLDNEW
« no previous file with comments | « remoting/host/win/session_input_injector.cc ('k') | remoting/host/win/unprivileged_process_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698