OLD | NEW |
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 // This file implements the Windows service controlling Me2Me host processes | 5 // This file implements the Windows service controlling Me2Me host processes |
6 // running within user sessions. | 6 // running within user sessions. |
7 | 7 |
| 8 #include <memory> |
8 #include <utility> | 9 #include <utility> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "remoting/base/auto_thread.h" | 17 #include "remoting/base/auto_thread.h" |
18 #include "remoting/base/auto_thread_task_runner.h" | 18 #include "remoting/base/auto_thread_task_runner.h" |
19 #include "remoting/host/desktop_process.h" | 19 #include "remoting/host/desktop_process.h" |
20 #include "remoting/host/host_exit_codes.h" | 20 #include "remoting/host/host_exit_codes.h" |
21 #include "remoting/host/host_main.h" | 21 #include "remoting/host/host_main.h" |
22 #include "remoting/host/me2me_desktop_environment.h" | 22 #include "remoting/host/me2me_desktop_environment.h" |
23 #include "remoting/host/switches.h" | 23 #include "remoting/host/switches.h" |
(...skipping 23 matching lines...) Expand all Loading... |
47 // Launch the input thread. | 47 // Launch the input thread. |
48 scoped_refptr<AutoThreadTaskRunner> input_task_runner = | 48 scoped_refptr<AutoThreadTaskRunner> input_task_runner = |
49 AutoThread::CreateWithType( | 49 AutoThread::CreateWithType( |
50 "Input thread", ui_task_runner, base::MessageLoop::TYPE_IO); | 50 "Input thread", ui_task_runner, base::MessageLoop::TYPE_IO); |
51 | 51 |
52 DesktopProcess desktop_process(ui_task_runner, | 52 DesktopProcess desktop_process(ui_task_runner, |
53 input_task_runner, | 53 input_task_runner, |
54 channel_name); | 54 channel_name); |
55 | 55 |
56 // Create a platform-dependent environment factory. | 56 // Create a platform-dependent environment factory. |
57 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory; | 57 std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory; |
58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
59 desktop_environment_factory.reset(new SessionDesktopEnvironmentFactory( | 59 desktop_environment_factory.reset(new SessionDesktopEnvironmentFactory( |
60 ui_task_runner, video_capture_task_runner, input_task_runner, | 60 ui_task_runner, video_capture_task_runner, input_task_runner, |
61 ui_task_runner, | 61 ui_task_runner, |
62 base::Bind(&DesktopProcess::InjectSas, desktop_process.AsWeakPtr()))); | 62 base::Bind(&DesktopProcess::InjectSas, desktop_process.AsWeakPtr()))); |
63 #else // !defined(OS_WIN) | 63 #else // !defined(OS_WIN) |
64 desktop_environment_factory.reset(new Me2MeDesktopEnvironmentFactory( | 64 desktop_environment_factory.reset(new Me2MeDesktopEnvironmentFactory( |
65 ui_task_runner, video_capture_task_runner, input_task_runner, | 65 ui_task_runner, video_capture_task_runner, input_task_runner, |
66 ui_task_runner)); | 66 ui_task_runner)); |
67 #endif // !defined(OS_WIN) | 67 #endif // !defined(OS_WIN) |
68 | 68 |
69 if (!desktop_process.Start(std::move(desktop_environment_factory))) | 69 if (!desktop_process.Start(std::move(desktop_environment_factory))) |
70 return kInitializationFailed; | 70 return kInitializationFailed; |
71 | 71 |
72 // Run the UI message loop. | 72 // Run the UI message loop. |
73 ui_task_runner = nullptr; | 73 ui_task_runner = nullptr; |
74 run_loop.Run(); | 74 run_loop.Run(); |
75 | 75 |
76 return kSuccessExitCode; | 76 return kSuccessExitCode; |
77 } | 77 } |
78 | 78 |
79 } // namespace remoting | 79 } // namespace remoting |
80 | 80 |
81 #if !defined(OS_WIN) | 81 #if !defined(OS_WIN) |
82 int main(int argc, char** argv) { | 82 int main(int argc, char** argv) { |
83 return remoting::HostMain(argc, argv); | 83 return remoting::HostMain(argc, argv); |
84 } | 84 } |
85 #endif // !defined(OS_WIN) | 85 #endif // !defined(OS_WIN) |
OLD | NEW |