| 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 #include "remoting/host/me2me_desktop_environment.h" | 5 #include "remoting/host/me2me_desktop_environment.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "media/video/capture/screen/screen_capturer.h" | 9 #include "media/video/capture/screen/screen_capturer.h" |
| 10 #include "remoting/host/client_session_control.h" | 10 #include "remoting/host/client_session_control.h" |
| 11 #include "remoting/host/desktop_resizer.h" | 11 #include "remoting/host/desktop_resizer.h" |
| 12 #include "remoting/host/host_window.h" | 12 #include "remoting/host/host_window.h" |
| 13 #include "remoting/host/host_window.h" |
| 14 #include "remoting/host/host_window_proxy.h" |
| 15 #include "remoting/host/local_input_monitor.h" |
| 13 #include "remoting/host/resizing_host_observer.h" | 16 #include "remoting/host/resizing_host_observer.h" |
| 14 #include "remoting/host/screen_controls.h" | 17 #include "remoting/host/screen_controls.h" |
| 15 #include "remoting/host/ui_strings.h" | 18 |
| 19 #if defined(OS_POSIX) |
| 20 #include <sys/types.h> |
| 21 #include <unistd.h> |
| 22 #endif // defined(OS_POSIX) |
| 16 | 23 |
| 17 namespace remoting { | 24 namespace remoting { |
| 18 | 25 |
| 19 Me2MeDesktopEnvironment::~Me2MeDesktopEnvironment() { | 26 Me2MeDesktopEnvironment::~Me2MeDesktopEnvironment() { |
| 20 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 27 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 21 } | 28 } |
| 22 | 29 |
| 23 scoped_ptr<ScreenControls> Me2MeDesktopEnvironment::CreateScreenControls() { | 30 scoped_ptr<ScreenControls> Me2MeDesktopEnvironment::CreateScreenControls() { |
| 24 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 31 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 25 | 32 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 36 #else // !defined(OS_LINUX) | 43 #else // !defined(OS_LINUX) |
| 37 return media::ScreenCapturer::Create(); | 44 return media::ScreenCapturer::Create(); |
| 38 #endif // !defined(OS_LINUX) | 45 #endif // !defined(OS_LINUX) |
| 39 } | 46 } |
| 40 | 47 |
| 41 Me2MeDesktopEnvironment::Me2MeDesktopEnvironment( | 48 Me2MeDesktopEnvironment::Me2MeDesktopEnvironment( |
| 42 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 49 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 43 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 50 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 44 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 51 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 45 base::WeakPtr<ClientSessionControl> client_session_control, | 52 base::WeakPtr<ClientSessionControl> client_session_control, |
| 46 const UiStrings* ui_strings) | 53 const UiStrings& ui_strings) |
| 47 : BasicDesktopEnvironment(caller_task_runner, | 54 : BasicDesktopEnvironment(caller_task_runner, |
| 48 input_task_runner, | 55 input_task_runner, |
| 49 ui_task_runner, | 56 ui_task_runner, |
| 57 client_session_control, |
| 50 ui_strings) { | 58 ui_strings) { |
| 51 DCHECK(caller_task_runner->BelongsToCurrentThread()); | 59 DCHECK(caller_task_runner->BelongsToCurrentThread()); |
| 52 | 60 |
| 53 // On Linux Me2Me sessions are virtualized and don't need UI. | 61 // Create the local input monitor. |
| 54 #if !defined(OS_LINUX) | 62 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner, |
| 55 InitNonCurtainedSessionUI(client_session_control); | 63 input_task_runner, |
| 56 #endif | 64 ui_task_runner, |
| 65 client_session_control); |
| 66 |
| 67 // The host UI should be created on the UI thread. |
| 68 bool want_user_interface = true; |
| 69 #if defined(OS_LINUX) |
| 70 want_user_interface = false; |
| 71 #elif defined(OS_MACOSX) |
| 72 // Don't try to display any UI on top of the system's login screen as this |
| 73 // is rejected by the Window Server on OS X 10.7.4, and prevents the |
| 74 // capturer from working (http://crbug.com/140984). |
| 75 |
| 76 // TODO(lambroslambrou): Use a better technique of detecting whether we're |
| 77 // running in the LoginWindow context, and refactor this into a separate |
| 78 // function to be used here and in CurtainMode::ActivateCurtain(). |
| 79 want_user_interface = getuid() != 0; |
| 80 #endif // defined(OS_MACOSX) |
| 81 |
| 82 // Create the disconnect window. |
| 83 if (want_user_interface) { |
| 84 disconnect_window_ = HostWindow::CreateDisconnectWindow(ui_strings); |
| 85 disconnect_window_.reset(new HostWindowProxy( |
| 86 caller_task_runner, |
| 87 ui_task_runner, |
| 88 disconnect_window_.Pass())); |
| 89 disconnect_window_->Start(client_session_control); |
| 90 } |
| 57 } | 91 } |
| 58 | 92 |
| 59 Me2MeDesktopEnvironmentFactory::Me2MeDesktopEnvironmentFactory( | 93 Me2MeDesktopEnvironmentFactory::Me2MeDesktopEnvironmentFactory( |
| 60 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 94 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 61 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 95 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 62 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 96 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 63 const UiStrings& ui_strings) | 97 const UiStrings& ui_strings) |
| 64 : BasicDesktopEnvironmentFactory(caller_task_runner, | 98 : BasicDesktopEnvironmentFactory(caller_task_runner, |
| 65 input_task_runner, | 99 input_task_runner, |
| 66 ui_task_runner, | 100 ui_task_runner, |
| 67 ui_strings) { | 101 ui_strings) { |
| 68 } | 102 } |
| 69 | 103 |
| 70 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() { | 104 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() { |
| 71 } | 105 } |
| 72 | 106 |
| 73 scoped_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( | 107 scoped_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( |
| 74 base::WeakPtr<ClientSessionControl> client_session_control) { | 108 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 75 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 109 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 76 | 110 |
| 77 return scoped_ptr<DesktopEnvironment>( | 111 return scoped_ptr<DesktopEnvironment>( |
| 78 new Me2MeDesktopEnvironment(caller_task_runner(), | 112 new Me2MeDesktopEnvironment(caller_task_runner(), |
| 79 input_task_runner(), | 113 input_task_runner(), |
| 80 ui_task_runner(), | 114 ui_task_runner(), |
| 81 client_session_control, | 115 client_session_control, |
| 82 &ui_strings())); | 116 ui_strings())); |
| 83 } | 117 } |
| 84 | 118 |
| 85 } // namespace remoting | 119 } // namespace remoting |
| OLD | NEW |