| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef REMOTING_HOST_WIN_WTS_CONSOLE_SESSION_PROCESS_DRIVER_H_ |
| 6 #define REMOTING_HOST_WIN_WTS_CONSOLE_SESSION_PROCESS_DRIVER_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/callback_forward.h" |
| 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "remoting/base/stoppable.h" |
| 13 #include "remoting/host/win/wts_console_observer.h" |
| 14 #include "remoting/host/worker_process_ipc_delegate.h" |
| 15 |
| 16 namespace base { |
| 17 class SingleThreadTaskRunner; |
| 18 } // namespace base |
| 19 |
| 20 namespace remoting { |
| 21 |
| 22 class WorkerProcessLauncher; |
| 23 class WtsConsoleMonitor; |
| 24 |
| 25 // Launches the host in the session attached to the console. When a new session |
| 26 // attaches to the console relaunches the host in it. |
| 27 class WtsConsoleSessionProcessDriver |
| 28 : public Stoppable, |
| 29 public WorkerProcessIpcDelegate, |
| 30 public WtsConsoleObserver { |
| 31 public: |
| 32 // Constructs a WtsConsoleSessionProcessDriver object. |stopped_callback| and |
| 33 // |main_task_runner| are passed to the undelying |Stoppable| implementation. |
| 34 // All interaction with |monitor| should happen on |main_task_runner|. |
| 35 // |io_task_runner| must be an I/O message loop. |
| 36 WtsConsoleSessionProcessDriver( |
| 37 const base::Closure& stopped_callback, |
| 38 WtsConsoleMonitor* monitor, |
| 39 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 40 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
| 41 |
| 42 virtual ~WtsConsoleSessionProcessDriver(); |
| 43 |
| 44 // WorkerProcessIpcDelegate implementation. |
| 45 virtual void OnChannelConnected() OVERRIDE; |
| 46 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 47 virtual void OnPermanentError() OVERRIDE; |
| 48 |
| 49 // WtsConsoleObserver implementation. |
| 50 virtual void OnSessionAttached(uint32 session_id) OVERRIDE; |
| 51 virtual void OnSessionDetached() OVERRIDE; |
| 52 |
| 53 protected: |
| 54 // Stoppable implementation. |
| 55 virtual void DoStop() OVERRIDE; |
| 56 |
| 57 private: |
| 58 // The task runner all public methods of this class should be called on. |
| 59 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 60 |
| 61 // Message loop used by the IPC channel. |
| 62 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 63 |
| 64 // Launches and monitors the worker process. |
| 65 scoped_refptr<WorkerProcessLauncher> launcher_; |
| 66 |
| 67 // This pointer is used to unsubscribe from session attach and detach events. |
| 68 WtsConsoleMonitor* monitor_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(WtsConsoleSessionProcessDriver); |
| 71 }; |
| 72 |
| 73 } // namespace remoting |
| 74 |
| 75 #endif // REMOTING_HOST_WIN_WTS_CONSOLE_SESSION_PROCESS_DRIVER_H_ |
| OLD | NEW |