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

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

Issue 10831271: [Chromoting] Adding uiAccess='true' to the remoting_me2me_host.exe's manifest as it is required to … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased + a couple of merge fixes. Created 8 years, 4 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 | Annotate | Revision Log
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_WTS_SESSION_PROCESS_LAUNCHER_H_ 5 #ifndef REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_
6 #define REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_ 6 #define REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h"
14 #include "base/process.h" 15 #include "base/process.h"
15 #include "base/time.h" 16 #include "base/time.h"
16 #include "base/timer.h" 17 #include "base/timer.h"
17 #include "base/win/scoped_handle.h" 18 #include "base/win/scoped_handle.h"
18 #include "ipc/ipc_channel.h" 19 #include "ipc/ipc_channel.h"
19 #include "remoting/base/stoppable.h" 20 #include "remoting/base/stoppable.h"
20 #include "remoting/host/win/worker_process_launcher.h" 21 #include "remoting/host/win/worker_process_launcher.h"
21 #include "remoting/host/win/wts_console_observer.h" 22 #include "remoting/host/win/wts_console_observer.h"
22 23
23 namespace base { 24 namespace base {
24 class SingleThreadTaskRunner; 25 class SingleThreadTaskRunner;
25 } // namespace base 26 } // namespace base
26 27
27 namespace IPC { 28 namespace IPC {
28 class ChannelProxy; 29 class ChannelProxy;
29 class Message; 30 class Message;
30 } // namespace IPC 31 } // namespace IPC
31 32
32 namespace remoting { 33 namespace remoting {
33 34
34 class SasInjector; 35 class SasInjector;
35 class WtsConsoleMonitor; 36 class WtsConsoleMonitor;
36 37
37 class WtsSessionProcessLauncher 38 class WtsSessionProcessLauncher
38 : public Stoppable, 39 : public base::MessagePumpForIO::IOHandler,
40 public Stoppable,
39 public WorkerProcessLauncher::Delegate, 41 public WorkerProcessLauncher::Delegate,
40 public WtsConsoleObserver { 42 public WtsConsoleObserver {
41 public: 43 public:
42 // Constructs a WtsSessionProcessLauncher object. |stopped_callback| and 44 // Constructs a WtsSessionProcessLauncher object. |stopped_callback| and
43 // |main_message_loop| are passed to the undelying |Stoppable| implementation. 45 // |main_message_loop| are passed to the undelying |Stoppable| implementation.
44 // All interaction with |monitor| should happen on |main_message_loop|. 46 // All interaction with |monitor| should happen on |main_message_loop|.
45 // |ipc_message_loop| must be an I/O message loop. 47 // |ipc_message_loop| must be an I/O message loop.
46 WtsSessionProcessLauncher( 48 WtsSessionProcessLauncher(
47 const base::Closure& stopped_callback, 49 const base::Closure& stopped_callback,
48 WtsConsoleMonitor* monitor, 50 WtsConsoleMonitor* monitor,
49 scoped_refptr<base::SingleThreadTaskRunner> main_message_loop, 51 scoped_refptr<base::SingleThreadTaskRunner> main_message_loop,
50 scoped_refptr<base::SingleThreadTaskRunner> ipc_message_loop); 52 scoped_refptr<base::SingleThreadTaskRunner> ipc_message_loop);
51 53
52 virtual ~WtsSessionProcessLauncher(); 54 virtual ~WtsSessionProcessLauncher();
53 55
56 // base::MessagePumpForIO::IOHandler implementation.
57 virtual void OnIOCompleted(base::MessagePumpForIO::IOContext* context,
58 DWORD bytes_transferred,
59 DWORD error) OVERRIDE;
60
54 // WorkerProcessLauncher::Delegate implementation. 61 // WorkerProcessLauncher::Delegate implementation.
55 virtual bool DoLaunchProcess( 62 virtual bool DoLaunchProcess(
56 const std::string& channel_name, 63 const std::string& channel_name,
57 base::win::ScopedHandle* process_exit_event_out) OVERRIDE; 64 base::win::ScopedHandle* process_exit_event_out) OVERRIDE;
58 virtual void DoKillProcess(DWORD exit_code) OVERRIDE; 65 virtual void DoKillProcess(DWORD exit_code) OVERRIDE;
59 virtual void OnChannelConnected() OVERRIDE; 66 virtual void OnChannelConnected() OVERRIDE;
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 67 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
61 68
62 // WtsConsoleObserver implementation. 69 // WtsConsoleObserver implementation.
63 virtual void OnSessionAttached(uint32 session_id) OVERRIDE; 70 virtual void OnSessionAttached(uint32 session_id) OVERRIDE;
64 virtual void OnSessionDetached() OVERRIDE; 71 virtual void OnSessionDetached() OVERRIDE;
65 72
66 protected: 73 protected:
67 // Stoppable implementation. 74 // Stoppable implementation.
68 virtual void DoStop() OVERRIDE; 75 virtual void DoStop() OVERRIDE;
69 76
70 private: 77 private:
78 // Drains the completion port queue to make sure that all job object
79 // notifications has been received.
80 void DrainJobNotifications();
81
82 // Notifies that the completion port queue has been drained.
83 void DrainJobNotificationsCompleted();
84
85 // Creates and initializes the job object that will sandbox the launched child
86 // processes.
87 void InitializeJob();
88
89 // Notifies that the job object initialization is complete.
90 void InitializeJobCompleted(scoped_ptr<base::win::ScopedHandle> job);
91
92 void OnJobNotification(DWORD message, DWORD pid);
93
71 // Attempts to launch the host process in the current console session. 94 // Attempts to launch the host process in the current console session.
72 // Schedules next launch attempt if creation of the process fails for any 95 // Schedules next launch attempt if creation of the process fails for any
73 // reason. 96 // reason.
74 void LaunchProcess(); 97 void LaunchProcess();
75 98
76 // Called when the launcher reports the process to be stopped. 99 // Called when the launcher reports the process to be stopped.
77 void OnLauncherStopped(); 100 void OnLauncherStopped();
78 101
79 // Sends the Secure Attention Sequence to the session represented by 102 // Sends the Secure Attention Sequence to the session represented by
80 // |session_token_|. 103 // |session_token_|.
(...skipping 15 matching lines...) Expand all
96 scoped_refptr<base::SingleThreadTaskRunner> main_message_loop_; 119 scoped_refptr<base::SingleThreadTaskRunner> main_message_loop_;
97 120
98 // Message loop used by the IPC channel. 121 // Message loop used by the IPC channel.
99 scoped_refptr<base::SingleThreadTaskRunner> ipc_message_loop_; 122 scoped_refptr<base::SingleThreadTaskRunner> ipc_message_loop_;
100 123
101 // This pointer is used to unsubscribe from session attach and detach events. 124 // This pointer is used to unsubscribe from session attach and detach events.
102 WtsConsoleMonitor* monitor_; 125 WtsConsoleMonitor* monitor_;
103 126
104 scoped_ptr<WorkerProcessLauncher> launcher_; 127 scoped_ptr<WorkerProcessLauncher> launcher_;
105 128
129 // The job object used to control the lifetime of child processes.
130 base::win::ScopedHandle job_;
131
132 // A waiting handle that becomes signalled once all process associated with
133 // the job have been terminated.
134 base::win::ScopedHandle process_exit_event_;
135
136 enum JobState {
137 kJobUninitialized,
138 kJobRunning,
139 kJobStopping,
140 kJobStopped
141 };
142
143 JobState job_state_;
144
106 base::win::ScopedHandle worker_process_; 145 base::win::ScopedHandle worker_process_;
107 146
108 // The token to be used to launch a process in a different session. 147 // The token to be used to launch a process in a different session.
109 base::win::ScopedHandle session_token_; 148 base::win::ScopedHandle session_token_;
110 149
111 scoped_ptr<SasInjector> sas_injector_; 150 scoped_ptr<SasInjector> sas_injector_;
112 151
113 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); 152 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher);
114 }; 153 };
115 154
116 } // namespace remoting 155 } // namespace remoting
117 156
118 #endif // REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_ 157 #endif // REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_
OLDNEW
« no previous file with comments | « remoting/host/win/launch_process_with_token.cc ('k') | remoting/host/win/wts_session_process_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698