BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / remoting / host / win / unprivileged_process_delegate.h
blob8de011f64db9dd124535664ae26878ebad0dafa2
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_
6 #define REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/non_thread_safe.h"
14 #include "base/win/scoped_handle.h"
15 #include "ipc/ipc_listener.h"
16 #include "remoting/host/win/worker_process_launcher.h"
18 namespace base {
19 class CommandLine;
20 class SingleThreadTaskRunner;
21 } // namespace base
23 namespace IPC {
24 class ChannelProxy;
25 class Message;
26 } // namespace IPC
28 namespace remoting {
30 // Implements logic for launching and monitoring a worker process under a less
31 // privileged user account.
32 class UnprivilegedProcessDelegate
33 : public base::NonThreadSafe,
34 public IPC::Listener,
35 public WorkerProcessLauncher::Delegate {
36 public:
37 UnprivilegedProcessDelegate(
38 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
39 scoped_ptr<base::CommandLine> target_command);
40 ~UnprivilegedProcessDelegate() override;
42 // WorkerProcessLauncher::Delegate implementation.
43 void LaunchProcess(WorkerProcessLauncher* event_handler) override;
44 void Send(IPC::Message* message) override;
45 void CloseChannel() override;
46 void KillProcess() override;
48 private:
49 // IPC::Listener implementation.
50 bool OnMessageReceived(const IPC::Message& message) override;
51 void OnChannelConnected(int32 peer_pid) override;
52 void OnChannelError() override;
54 void ReportFatalError();
55 void ReportProcessLaunched(base::win::ScopedHandle worker_process);
57 // The task runner serving job object notifications.
58 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
60 // Command line of the launched process.
61 scoped_ptr<base::CommandLine> target_command_;
63 // The server end of the IPC channel used to communicate to the worker
64 // process.
65 scoped_ptr<IPC::ChannelProxy> channel_;
67 WorkerProcessLauncher* event_handler_;
69 // The handle of the worker process, if launched.
70 base::win::ScopedHandle worker_process_;
72 DISALLOW_COPY_AND_ASSIGN(UnprivilegedProcessDelegate);
75 } // namespace remoting
77 #endif // REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_