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/basic_desktop_environment.h" | 5 #include "remoting/host/basic_desktop_environment.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "media/video/capture/screen/screen_capturer.h" | 10 #include "media/video/capture/screen/screen_capturer.h" |
11 #include "remoting/host/audio_capturer.h" | 11 #include "remoting/host/audio_capturer.h" |
12 #include "remoting/host/client_session_control.h" | 12 #include "remoting/host/client_session_control.h" |
13 #include "remoting/host/host_window.h" | 13 #include "remoting/host/host_window.h" |
14 #include "remoting/host/host_window_proxy.h" | 14 #include "remoting/host/host_window_proxy.h" |
15 #include "remoting/host/input_injector.h" | 15 #include "remoting/host/input_injector.h" |
16 #include "remoting/host/local_input_monitor.h" | 16 #include "remoting/host/local_input_monitor.h" |
17 #include "remoting/host/screen_controls.h" | 17 #include "remoting/host/screen_controls.h" |
18 #include "remoting/host/ui_strings.h" | |
19 | 18 |
20 #if defined(OS_POSIX) | 19 #if defined(OS_POSIX) |
21 #include <sys/types.h> | 20 #include <sys/types.h> |
22 #include <unistd.h> | 21 #include <unistd.h> |
23 #endif // defined(OS_POSIX) | 22 #endif // defined(OS_POSIX) |
24 | 23 |
25 namespace remoting { | 24 namespace remoting { |
26 | 25 |
27 BasicDesktopEnvironment::~BasicDesktopEnvironment() { | 26 BasicDesktopEnvironment::~BasicDesktopEnvironment() { |
28 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 27 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
(...skipping 24 matching lines...) Expand all Loading... |
53 // The basic desktop environment does not use X DAMAGE, since it is | 52 // The basic desktop environment does not use X DAMAGE, since it is |
54 // broken on many systems - see http://crbug.com/73423. | 53 // broken on many systems - see http://crbug.com/73423. |
55 return media::ScreenCapturer::Create(); | 54 return media::ScreenCapturer::Create(); |
56 } | 55 } |
57 | 56 |
58 BasicDesktopEnvironment::BasicDesktopEnvironment( | 57 BasicDesktopEnvironment::BasicDesktopEnvironment( |
59 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 58 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
60 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 59 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
61 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 60 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
62 base::WeakPtr<ClientSessionControl> client_session_control, | 61 base::WeakPtr<ClientSessionControl> client_session_control, |
63 const UiStrings* ui_strings) | 62 const UiStrings& ui_strings) |
64 : caller_task_runner_(caller_task_runner), | 63 : caller_task_runner_(caller_task_runner), |
65 input_task_runner_(input_task_runner), | 64 input_task_runner_(input_task_runner), |
66 ui_task_runner_(ui_task_runner), | 65 ui_task_runner_(ui_task_runner) { |
67 ui_strings_(ui_strings) { | |
68 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 66 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
69 | 67 |
70 // Create the local input monitor. | 68 // Create the local input monitor. |
71 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner_, | 69 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner_, |
72 input_task_runner_, | 70 input_task_runner_, |
73 ui_task_runner_, | 71 ui_task_runner_, |
74 client_session_control); | 72 client_session_control); |
75 | 73 |
76 // The host UI should be created on the UI thread. | 74 // The host UI should be created on the UI thread. |
77 bool want_user_interface = true; | 75 bool want_user_interface = true; |
78 #if defined(OS_LINUX) | 76 #if defined(OS_LINUX) |
79 want_user_interface = false; | 77 want_user_interface = false; |
80 #elif defined(OS_MACOSX) | 78 #elif defined(OS_MACOSX) |
81 // Don't try to display any UI on top of the system's login screen as this | 79 // Don't try to display any UI on top of the system's login screen as this |
82 // is rejected by the Window Server on OS X 10.7.4, and prevents the | 80 // is rejected by the Window Server on OS X 10.7.4, and prevents the |
83 // capturer from working (http://crbug.com/140984). | 81 // capturer from working (http://crbug.com/140984). |
84 | 82 |
85 // TODO(lambroslambrou): Use a better technique of detecting whether we're | 83 // TODO(lambroslambrou): Use a better technique of detecting whether we're |
86 // running in the LoginWindow context, and refactor this into a separate | 84 // running in the LoginWindow context, and refactor this into a separate |
87 // function to be used here and in CurtainMode::ActivateCurtain(). | 85 // function to be used here and in CurtainMode::ActivateCurtain(). |
88 want_user_interface = getuid() != 0; | 86 want_user_interface = getuid() != 0; |
89 #endif // OS_MACOSX | 87 #endif // OS_MACOSX |
90 | 88 |
91 // Create the disconnect window. | 89 // Create the disconnect window. |
92 if (want_user_interface) { | 90 if (want_user_interface) { |
93 disconnect_window_ = HostWindow::CreateDisconnectWindow(*ui_strings_); | 91 disconnect_window_ = HostWindow::CreateDisconnectWindow(ui_strings); |
94 disconnect_window_.reset(new HostWindowProxy( | 92 disconnect_window_.reset(new HostWindowProxy( |
95 caller_task_runner_, | 93 caller_task_runner_, |
96 ui_task_runner_, | 94 ui_task_runner_, |
97 disconnect_window_.Pass())); | 95 disconnect_window_.Pass())); |
98 disconnect_window_->Start(client_session_control); | 96 disconnect_window_->Start(client_session_control); |
99 } | 97 } |
100 } | 98 } |
101 | 99 |
102 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory( | 100 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory( |
103 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 101 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
(...skipping 11 matching lines...) Expand all Loading... |
115 | 113 |
116 scoped_ptr<DesktopEnvironment> BasicDesktopEnvironmentFactory::Create( | 114 scoped_ptr<DesktopEnvironment> BasicDesktopEnvironmentFactory::Create( |
117 base::WeakPtr<ClientSessionControl> client_session_control) { | 115 base::WeakPtr<ClientSessionControl> client_session_control) { |
118 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 116 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
119 | 117 |
120 return scoped_ptr<DesktopEnvironment>( | 118 return scoped_ptr<DesktopEnvironment>( |
121 new BasicDesktopEnvironment(caller_task_runner(), | 119 new BasicDesktopEnvironment(caller_task_runner(), |
122 input_task_runner(), | 120 input_task_runner(), |
123 ui_task_runner(), | 121 ui_task_runner(), |
124 client_session_control, | 122 client_session_control, |
125 &ui_strings_)); | 123 ui_strings_)); |
126 } | 124 } |
127 | 125 |
128 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { | 126 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { |
129 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 127 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
130 | 128 |
131 return AudioCapturer::IsSupported(); | 129 return AudioCapturer::IsSupported(); |
132 } | 130 } |
133 | 131 |
134 } // namespace remoting | 132 } // namespace remoting |
OLD | NEW |