Revert of Remove OneClickSigninHelper since it is no longer used. (patchset #5 id...
[chromium-blink-merge.git] / remoting / host / desktop_process.h
blob2710504b20fec89ef04bd5fb6aaf3aadf4507d11
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_DESKTOP_PROCESS_H_
6 #define REMOTING_HOST_DESKTOP_PROCESS_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h"
16 #include "ipc/ipc_listener.h"
17 #include "remoting/host/desktop_session_agent.h"
19 namespace IPC {
20 class ChannelProxy;
21 } // namespace IPC
23 namespace remoting {
25 class AutoThreadTaskRunner;
26 class DesktopEnvironment;
27 class DesktopEnvironmentFactory;
28 class DesktopSessionAgent;
30 class DesktopProcess : public DesktopSessionAgent::Delegate,
31 public IPC::Listener,
32 public base::SupportsWeakPtr<DesktopProcess> {
33 public:
34 DesktopProcess(
35 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
36 scoped_refptr<AutoThreadTaskRunner> input_task_runner,
37 const std::string& daemon_channel_name);
38 ~DesktopProcess() override;
40 // DesktopSessionAgent::Delegate implementation.
41 DesktopEnvironmentFactory& desktop_environment_factory() override;
42 void OnNetworkProcessDisconnected() override;
44 // IPC::Listener implementation.
45 bool OnMessageReceived(const IPC::Message& message) override;
46 void OnChannelConnected(int32 peer_pid) override;
47 void OnChannelError() override;
49 // Injects Secure Attention Sequence.
50 void InjectSas();
52 // Creates the desktop agent and required threads and IPC channels. Returns
53 // true on success.
54 bool Start(scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory);
56 private:
57 // Crashes the process in response to a daemon's request. The daemon passes
58 // the location of the code that detected the fatal error resulted in this
59 // request. See the declaration of ChromotingDaemonMsg_Crash message.
60 void OnCrash(const std::string& function_name,
61 const std::string& file_name,
62 const int& line_number);
64 // Task runner on which public methods of this class should be called.
65 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_;
67 // Used to run input-related tasks.
68 scoped_refptr<AutoThreadTaskRunner> input_task_runner_;
70 // Factory used to create integration components for use by |desktop_agent_|.
71 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
73 // Name of the IPC channel connecting the desktop process with the daemon
74 // process.
75 std::string daemon_channel_name_;
77 // IPC channel connecting the desktop process with the daemon process.
78 scoped_ptr<IPC::ChannelProxy> daemon_channel_;
80 // Provides screen/audio capturing and input injection services for
81 // the network process.
82 scoped_refptr<DesktopSessionAgent> desktop_agent_;
84 DISALLOW_COPY_AND_ASSIGN(DesktopProcess);
87 } // namespace remoting
89 #endif // REMOTING_HOST_DESKTOP_PROCESS_H_