Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/it2me_desktop_environment.h" | 5 #include "remoting/host/it2me_desktop_environment.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | |
|
joedow
2016/05/03 22:28:29
Can you remove this header now?
Hzj_jie
2016/05/04 02:11:56
Done.
| |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "remoting/host/client_session_control.h" | 14 #include "remoting/host/client_session_control.h" |
| 14 #include "remoting/host/host_window.h" | 15 #include "remoting/host/host_window.h" |
| 15 #include "remoting/host/host_window_proxy.h" | 16 #include "remoting/host/host_window_proxy.h" |
| 16 #include "remoting/host/local_input_monitor.h" | 17 #include "remoting/host/local_input_monitor.h" |
| 17 | 18 |
| 18 #if defined(OS_POSIX) | 19 #if defined(OS_POSIX) |
| 19 #include <sys/types.h> | 20 #include <sys/types.h> |
| 20 #include <unistd.h> | 21 #include <unistd.h> |
| 21 #endif // defined(OS_POSIX) | 22 #endif // defined(OS_POSIX) |
| 22 | 23 |
| 23 namespace remoting { | 24 namespace remoting { |
| 24 | 25 |
| 25 It2MeDesktopEnvironment::~It2MeDesktopEnvironment() { | 26 It2MeDesktopEnvironment::~It2MeDesktopEnvironment() { |
| 26 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 27 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 27 } | 28 } |
| 28 | 29 |
| 29 It2MeDesktopEnvironment::It2MeDesktopEnvironment( | 30 It2MeDesktopEnvironment::It2MeDesktopEnvironment( |
| 30 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 31 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 31 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 32 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 32 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 33 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 33 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 34 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 34 base::WeakPtr<ClientSessionControl> client_session_control, | 35 base::WeakPtr<ClientSessionControl> client_session_control, |
| 35 bool supports_touch_events) | 36 bool supports_touch_events, |
| 37 bool enable_user_interface) | |
| 36 : BasicDesktopEnvironment(caller_task_runner, | 38 : BasicDesktopEnvironment(caller_task_runner, |
| 37 video_capture_task_runner, | 39 video_capture_task_runner, |
| 38 input_task_runner, | 40 input_task_runner, |
| 39 ui_task_runner, | 41 ui_task_runner, |
| 40 supports_touch_events) { | 42 supports_touch_events) { |
| 41 DCHECK(caller_task_runner->BelongsToCurrentThread()); | 43 DCHECK(caller_task_runner->BelongsToCurrentThread()); |
| 42 | 44 |
| 43 // Create the local input monitor. | 45 // Create the local input monitor. |
| 44 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner, | 46 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner, |
| 45 input_task_runner, | 47 input_task_runner, |
| 46 ui_task_runner, | 48 ui_task_runner, |
| 47 client_session_control); | 49 client_session_control); |
| 48 | 50 |
| 49 // The host UI should be created on the UI thread. | 51 // The host UI should be created on the UI thread. |
| 50 bool want_user_interface = true; | |
| 51 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
| 52 // Don't try to display any UI on top of the system's login screen as this | 53 // Don't try to display any UI on top of the system's login screen as this |
| 53 // is rejected by the Window Server on OS X 10.7.4, and prevents the | 54 // is rejected by the Window Server on OS X 10.7.4, and prevents the |
| 54 // capturer from working (http://crbug.com/140984). | 55 // capturer from working (http://crbug.com/140984). |
| 55 | 56 |
| 56 // TODO(lambroslambrou): Use a better technique of detecting whether we're | 57 // TODO(lambroslambrou): Use a better technique of detecting whether we're |
| 57 // running in the LoginWindow context, and refactor this into a separate | 58 // running in the LoginWindow context, and refactor this into a separate |
| 58 // function to be used here and in CurtainMode::ActivateCurtain(). | 59 // function to be used here and in CurtainMode::ActivateCurtain(). |
| 59 want_user_interface = getuid() != 0; | 60 enable_user_interface = getuid() != 0; |
| 60 #endif // defined(OS_MACOSX) | 61 #endif // defined(OS_MACOSX) |
| 61 | 62 |
| 62 // Create the continue and disconnect windows. | 63 // Create the continue and disconnect windows. |
| 63 if (want_user_interface) { | 64 if (enable_user_interface) { |
| 64 continue_window_ = HostWindow::CreateContinueWindow(); | 65 continue_window_ = HostWindow::CreateContinueWindow(); |
| 65 continue_window_.reset(new HostWindowProxy( | 66 continue_window_.reset(new HostWindowProxy( |
| 66 caller_task_runner, ui_task_runner, std::move(continue_window_))); | 67 caller_task_runner, ui_task_runner, std::move(continue_window_))); |
| 67 continue_window_->Start(client_session_control); | 68 continue_window_->Start(client_session_control); |
| 68 | 69 |
| 69 disconnect_window_ = HostWindow::CreateDisconnectWindow(); | 70 disconnect_window_ = HostWindow::CreateDisconnectWindow(); |
| 70 disconnect_window_.reset(new HostWindowProxy( | 71 disconnect_window_.reset(new HostWindowProxy( |
| 71 caller_task_runner, ui_task_runner, std::move(disconnect_window_))); | 72 caller_task_runner, ui_task_runner, std::move(disconnect_window_))); |
| 72 disconnect_window_->Start(client_session_control); | 73 disconnect_window_->Start(client_session_control); |
| 73 } | 74 } |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 84 ui_task_runner) {} | 85 ui_task_runner) {} |
| 85 | 86 |
| 86 It2MeDesktopEnvironmentFactory::~It2MeDesktopEnvironmentFactory() {} | 87 It2MeDesktopEnvironmentFactory::~It2MeDesktopEnvironmentFactory() {} |
| 87 | 88 |
| 88 std::unique_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create( | 89 std::unique_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create( |
| 89 base::WeakPtr<ClientSessionControl> client_session_control) { | 90 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 90 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 91 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 91 | 92 |
| 92 return base::WrapUnique(new It2MeDesktopEnvironment( | 93 return base::WrapUnique(new It2MeDesktopEnvironment( |
| 93 caller_task_runner(), video_capture_task_runner(), input_task_runner(), | 94 caller_task_runner(), video_capture_task_runner(), input_task_runner(), |
| 94 ui_task_runner(), client_session_control, supports_touch_events())); | 95 ui_task_runner(), client_session_control, supports_touch_events(), |
| 96 enable_user_interface_)); | |
| 95 } | 97 } |
| 96 | 98 |
| 97 } // namespace remoting | 99 } // namespace remoting |
| OLD | NEW |