OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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. |
| 4 |
| 5 #include "remoting/host/it2me_desktop_environment.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/single_thread_task_runner.h" |
| 9 #include "remoting/host/client_session_control.h" |
| 10 #include "remoting/host/host_window.h" |
| 11 #include "remoting/host/host_window_proxy.h" |
| 12 #include "remoting/host/local_input_monitor.h" |
| 13 |
| 14 #if defined(OS_POSIX) |
| 15 #include <sys/types.h> |
| 16 #include <unistd.h> |
| 17 #endif // defined(OS_POSIX) |
| 18 |
| 19 namespace remoting { |
| 20 |
| 21 It2MeDesktopEnvironment::~It2MeDesktopEnvironment() { |
| 22 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 23 } |
| 24 |
| 25 It2MeDesktopEnvironment::It2MeDesktopEnvironment( |
| 26 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 27 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 28 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 29 base::WeakPtr<ClientSessionControl> client_session_control, |
| 30 const UiStrings& ui_strings) |
| 31 : BasicDesktopEnvironment(caller_task_runner, |
| 32 input_task_runner, |
| 33 ui_task_runner, |
| 34 client_session_control, |
| 35 ui_strings) { |
| 36 DCHECK(caller_task_runner->BelongsToCurrentThread()); |
| 37 |
| 38 // Create the local input monitor. |
| 39 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner, |
| 40 input_task_runner, |
| 41 ui_task_runner, |
| 42 client_session_control); |
| 43 |
| 44 // The host UI should be created on the UI thread. |
| 45 bool want_user_interface = true; |
| 46 #if defined(OS_MACOSX) |
| 47 // Don't try to display any UI on top of the system's login screen as this |
| 48 // is rejected by the Window Server on OS X 10.7.4, and prevents the |
| 49 // capturer from working (http://crbug.com/140984). |
| 50 |
| 51 // TODO(lambroslambrou): Use a better technique of detecting whether we're |
| 52 // running in the LoginWindow context, and refactor this into a separate |
| 53 // function to be used here and in CurtainMode::ActivateCurtain(). |
| 54 want_user_interface = getuid() != 0; |
| 55 #endif // defined(OS_MACOSX) |
| 56 |
| 57 // Create the continue and disconnect windows. |
| 58 if (want_user_interface) { |
| 59 continue_window_ = HostWindow::CreateContinueWindow(ui_strings); |
| 60 continue_window_.reset(new HostWindowProxy( |
| 61 caller_task_runner, |
| 62 ui_task_runner, |
| 63 continue_window_.Pass())); |
| 64 continue_window_->Start(client_session_control); |
| 65 |
| 66 disconnect_window_ = HostWindow::CreateDisconnectWindow(ui_strings); |
| 67 disconnect_window_.reset(new HostWindowProxy( |
| 68 caller_task_runner, |
| 69 ui_task_runner, |
| 70 disconnect_window_.Pass())); |
| 71 disconnect_window_->Start(client_session_control); |
| 72 } |
| 73 } |
| 74 |
| 75 It2MeDesktopEnvironmentFactory::It2MeDesktopEnvironmentFactory( |
| 76 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 77 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 78 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 79 const UiStrings& ui_strings) |
| 80 : BasicDesktopEnvironmentFactory(caller_task_runner, |
| 81 input_task_runner, |
| 82 ui_task_runner, |
| 83 ui_strings) { |
| 84 } |
| 85 |
| 86 It2MeDesktopEnvironmentFactory::~It2MeDesktopEnvironmentFactory() { |
| 87 } |
| 88 |
| 89 scoped_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create( |
| 90 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 91 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 92 |
| 93 return scoped_ptr<DesktopEnvironment>( |
| 94 new It2MeDesktopEnvironment(caller_task_runner(), |
| 95 input_task_runner(), |
| 96 ui_task_runner(), |
| 97 client_session_control, |
| 98 ui_strings())); |
| 99 } |
| 100 |
| 101 } // namespace remoting |
OLD | NEW |