| 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 "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 14 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 15 #include "base/scoped_native_library.h" | 16 #include "base/scoped_native_library.h" |
| 16 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 18 #include "base/win/windows_version.h" | 19 #include "base/win/windows_version.h" |
| 19 #include "remoting/base/auto_thread_task_runner.h" | 20 #include "remoting/base/auto_thread_task_runner.h" |
| 20 #include "remoting/base/breakpad.h" | 21 #include "remoting/base/breakpad.h" |
| 22 #include "remoting/host/basic_desktop_environment.h" |
| 21 #include "remoting/host/desktop_process.h" | 23 #include "remoting/host/desktop_process.h" |
| 22 #include "remoting/host/host_exit_codes.h" | 24 #include "remoting/host/host_exit_codes.h" |
| 23 #include "remoting/host/logging.h" | 25 #include "remoting/host/logging.h" |
| 24 #include "remoting/host/usage_stats_consent.h" | 26 #include "remoting/host/usage_stats_consent.h" |
| 27 #include "remoting/host/win/session_desktop_environment.h" |
| 25 | 28 |
| 26 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
| 27 #include "base/mac/scoped_nsautorelease_pool.h" | 30 #include "base/mac/scoped_nsautorelease_pool.h" |
| 28 #endif // defined(OS_MACOSX) | 31 #endif // defined(OS_MACOSX) |
| 29 | 32 |
| 30 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 31 #include <commctrl.h> | 34 #include <commctrl.h> |
| 32 #endif // defined(OS_WIN) | 35 #endif // defined(OS_WIN) |
| 33 | 36 |
| 34 namespace { | 37 namespace { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 base::RunLoop run_loop; | 90 base::RunLoop run_loop; |
| 88 base::Closure quit_ui_task_runner = base::Bind( | 91 base::Closure quit_ui_task_runner = base::Bind( |
| 89 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), | 92 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), |
| 90 message_loop.message_loop_proxy(), | 93 message_loop.message_loop_proxy(), |
| 91 FROM_HERE, run_loop.QuitClosure()); | 94 FROM_HERE, run_loop.QuitClosure()); |
| 92 scoped_refptr<remoting::AutoThreadTaskRunner> ui_task_runner = | 95 scoped_refptr<remoting::AutoThreadTaskRunner> ui_task_runner = |
| 93 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 96 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
| 94 quit_ui_task_runner); | 97 quit_ui_task_runner); |
| 95 | 98 |
| 96 remoting::DesktopProcess desktop_process(ui_task_runner, channel_name); | 99 remoting::DesktopProcess desktop_process(ui_task_runner, channel_name); |
| 97 if (!desktop_process.Start()) | 100 |
| 101 // Create a platform-dependent environment factory. |
| 102 scoped_ptr<remoting::DesktopEnvironmentFactory> desktop_environment_factory; |
| 103 #if defined(OS_WIN) |
| 104 desktop_environment_factory.reset( |
| 105 new remoting::SessionDesktopEnvironmentFactory( |
| 106 base::Bind(&remoting::DesktopProcess::InjectSas, |
| 107 desktop_process.AsWeakPtr()))); |
| 108 #else // !defined(OS_WIN) |
| 109 desktop_environment_factory.reset( |
| 110 new remoting::BasicDesktopEnvironmentFactory(true)); |
| 111 #endif // !defined(OS_WIN) |
| 112 |
| 113 if (!desktop_process.Start(desktop_environment_factory.Pass())) |
| 98 return remoting::kInitializationFailed; | 114 return remoting::kInitializationFailed; |
| 99 | 115 |
| 100 // Run the UI message loop. | 116 // Run the UI message loop. |
| 101 ui_task_runner = NULL; | 117 ui_task_runner = NULL; |
| 102 run_loop.Run(); | 118 run_loop.Run(); |
| 103 | 119 |
| 104 return remoting::kSuccessExitCode; | 120 return remoting::kSuccessExitCode; |
| 105 } | 121 } |
| 106 | 122 |
| 107 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 135 user32.GetFunctionPointer("SetProcessDPIAware")); | 151 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 136 set_process_dpi_aware(); | 152 set_process_dpi_aware(); |
| 137 } | 153 } |
| 138 | 154 |
| 139 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 155 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 140 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 156 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 141 return main(0, NULL); | 157 return main(0, NULL); |
| 142 } | 158 } |
| 143 | 159 |
| 144 #endif // defined(OS_WIN) | 160 #endif // defined(OS_WIN) |
| OLD | NEW |