Chromium Code Reviews| 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 "remoting/host/desktop_process_main.h" | 8 #include "remoting/host/desktop_process_main.h" |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/scoped_native_library.h" | 17 #include "base/scoped_native_library.h" |
| 18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
| 21 #include "remoting/base/auto_thread_task_runner.h" | 21 #include "remoting/base/auto_thread_task_runner.h" |
| 22 #include "remoting/base/breakpad.h" | 22 #include "remoting/base/breakpad.h" |
| 23 #include "remoting/host/basic_desktop_environment.h" | |
| 23 #include "remoting/host/desktop_process.h" | 24 #include "remoting/host/desktop_process.h" |
| 24 #include "remoting/host/host_exit_codes.h" | 25 #include "remoting/host/host_exit_codes.h" |
| 25 #include "remoting/host/logging.h" | 26 #include "remoting/host/logging.h" |
| 26 #include "remoting/host/usage_stats_consent.h" | 27 #include "remoting/host/usage_stats_consent.h" |
| 28 #include "remoting/host/win/session_desktop_environment.h" | |
| 27 | 29 |
| 28 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
| 29 #include "base/mac/scoped_nsautorelease_pool.h" | 31 #include "base/mac/scoped_nsautorelease_pool.h" |
| 30 #endif // defined(OS_MACOSX) | 32 #endif // defined(OS_MACOSX) |
| 31 | 33 |
| 32 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 33 #include <commctrl.h> | 35 #include <commctrl.h> |
| 34 #endif // defined(OS_WIN) | 36 #endif // defined(OS_WIN) |
| 35 | 37 |
| 36 namespace { | 38 namespace { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 base::RunLoop run_loop; | 124 base::RunLoop run_loop; |
| 123 base::Closure quit_ui_task_runner = base::Bind( | 125 base::Closure quit_ui_task_runner = base::Bind( |
| 124 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), | 126 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), |
| 125 message_loop.message_loop_proxy(), | 127 message_loop.message_loop_proxy(), |
| 126 FROM_HERE, run_loop.QuitClosure()); | 128 FROM_HERE, run_loop.QuitClosure()); |
| 127 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = | 129 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = |
| 128 new AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 130 new AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
| 129 quit_ui_task_runner); | 131 quit_ui_task_runner); |
| 130 | 132 |
| 131 DesktopProcess desktop_process(ui_task_runner, channel_name); | 133 DesktopProcess desktop_process(ui_task_runner, channel_name); |
| 132 if (!desktop_process.Start()) | 134 |
| 135 // Create proper kind of desktop environment factory. | |
|
Wez
2013/02/01 01:02:11
nit: "... proper kind of ..." -> "... platform-dep
alexeypa (please no reviews)
2013/02/01 17:28:43
Done.
| |
| 136 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory; | |
| 137 #if defined(OS_WIN) | |
| 138 desktop_environment_factory.reset(new SessionDesktopEnvironmentFactory( | |
| 139 base::Bind(&DesktopProcess::InjectSas, desktop_process.AsWeakPtr()))); | |
| 140 #else // !defined(OS_WIN) | |
| 141 desktop_environment_factory.reset(new BasicDesktopEnvironmentFactory()); | |
| 142 #endif // !defined(OS_WIN) | |
| 143 | |
| 144 if (!desktop_process.Start(desktop_environment_factory.Pass())) | |
| 133 return kInitializationFailed; | 145 return kInitializationFailed; |
| 134 | 146 |
| 135 // Run the UI message loop. | 147 // Run the UI message loop. |
| 136 ui_task_runner = NULL; | 148 ui_task_runner = NULL; |
| 137 run_loop.Run(); | 149 run_loop.Run(); |
| 138 | 150 |
| 139 return kSuccessExitCode; | 151 return kSuccessExitCode; |
| 140 } | 152 } |
| 141 | 153 |
| 142 } // namespace remoting | 154 } // namespace remoting |
| 143 | 155 |
| 144 #if !defined(OS_WIN) | 156 #if !defined(OS_WIN) |
| 145 int main(int argc, char** argv) { | 157 int main(int argc, char** argv) { |
| 146 return remoting::DesktopProcessMain(argc, argv); | 158 return remoting::DesktopProcessMain(argc, argv); |
| 147 } | 159 } |
| 148 #endif // !defined(OS_WIN) | 160 #endif // !defined(OS_WIN) |
| OLD | NEW |