Index: remoting/host/basic_desktop_environment.cc |
diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc |
index 21d6600a10c5a91cb0a5593d9e10ec7108975a0a..9174e04342de5905423034568f813cd7f2b61b39 100644 |
--- a/remoting/host/basic_desktop_environment.cc |
+++ b/remoting/host/basic_desktop_environment.cc |
@@ -4,14 +4,23 @@ |
#include "remoting/host/basic_desktop_environment.h" |
+#include "base/bind.h" |
#include "base/logging.h" |
#include "base/single_thread_task_runner.h" |
#include "media/video/capture/screen/screen_capturer.h" |
#include "remoting/host/audio_capturer.h" |
#include "remoting/host/client_session_control.h" |
+#include "remoting/host/host_window.h" |
+#include "remoting/host/host_window_proxy.h" |
#include "remoting/host/input_injector.h" |
#include "remoting/host/local_input_monitor.h" |
#include "remoting/host/screen_controls.h" |
+#include "remoting/host/ui_strings.h" |
+ |
+#if defined(OS_POSIX) |
+#include <sys/types.h> |
+#include <unistd.h> |
+#endif // defined(OS_POSIX) |
namespace remoting { |
@@ -50,10 +59,12 @@ BasicDesktopEnvironment::BasicDesktopEnvironment( |
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
- base::WeakPtr<ClientSessionControl> client_session_control) |
+ base::WeakPtr<ClientSessionControl> client_session_control, |
+ const UiStrings* ui_strings) |
: caller_task_runner_(caller_task_runner), |
input_task_runner_(input_task_runner), |
- ui_task_runner_(ui_task_runner) { |
+ ui_task_runner_(ui_task_runner), |
+ ui_strings_(ui_strings) { |
DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
// Create the local input monitor. |
@@ -61,15 +72,42 @@ BasicDesktopEnvironment::BasicDesktopEnvironment( |
input_task_runner_, |
ui_task_runner_, |
client_session_control); |
+ |
+ // The host UI should be created on the UI thread. |
+ bool want_user_interface = true; |
+#if defined(OS_LINUX) |
+ want_user_interface = false; |
+#elif defined(OS_MACOSX) |
+ // Don't try to display any UI on top of the system's login screen as this |
+ // is rejected by the Window Server on OS X 10.7.4, and prevents the |
+ // capturer from working (http://crbug.com/140984). |
+ |
+ // TODO(lambroslambrou): Use a better technique of detecting whether we're |
+ // running in the LoginWindow context, and refactor this into a separate |
+ // function to be used here and in CurtainMode::ActivateCurtain(). |
+ want_user_interface = getuid() != 0; |
+#endif // OS_MACOSX |
+ |
+ // Create the disconnect window. |
+ if (want_user_interface) { |
+ disconnect_window_ = HostWindow::CreateDisconnectWindow(*ui_strings_); |
+ disconnect_window_.reset(new HostWindowProxy( |
+ caller_task_runner_, |
+ ui_task_runner_, |
+ disconnect_window_.Pass())); |
+ disconnect_window_->Start(client_session_control); |
+ } |
} |
BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory( |
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
+ const UiStrings& ui_strings) |
: caller_task_runner_(caller_task_runner), |
input_task_runner_(input_task_runner), |
- ui_task_runner_(ui_task_runner) { |
+ ui_task_runner_(ui_task_runner), |
+ ui_strings_(ui_strings) { |
} |
BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() { |
@@ -83,7 +121,8 @@ scoped_ptr<DesktopEnvironment> BasicDesktopEnvironmentFactory::Create( |
new BasicDesktopEnvironment(caller_task_runner(), |
input_task_runner(), |
ui_task_runner(), |
- client_session_control)); |
+ client_session_control, |
+ &ui_strings_)); |
} |
bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { |