Avi Drissman | d6cdf9b | 2022-09-15 19:52:53 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 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/me2me_desktop_environment.h" |
| 6 | |
Peter Boström | 42afa23f | 2021-04-02 22:10:46 | [diff] [blame] | 7 | #include <memory> |
sergeyu | 1417e013 | 2015-12-23 19:01:22 | [diff] [blame] | 8 | #include <utility> |
| 9 | |
Yuwei Huang | c7ec1c0 | 2022-09-22 22:09:29 | [diff] [blame] | 10 | #include "base/environment.h" |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 11 | #include "base/logging.h" |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 12 | #include "base/memory/ptr_util.h" |
Patrick Monette | 643cdf6 | 2021-10-15 19:13:42 | [diff] [blame] | 13 | #include "base/task/single_thread_task_runner.h" |
avi | c5960f3 | 2015-12-22 22:49:48 | [diff] [blame] | 14 | #include "build/build_config.h" |
[email protected] | 3a5b82c | 2014-02-20 13:28:14 | [diff] [blame] | 15 | #include "remoting/base/logging.h" |
Joe Downing | 505ae0d0 | 2018-10-17 17:47:30 | [diff] [blame] | 16 | #include "remoting/host/action_executor.h" |
Joe Downing | b0fb542 | 2021-12-07 21:26:20 | [diff] [blame] | 17 | #include "remoting/host/base/screen_controls.h" |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 18 | #include "remoting/host/client_session_control.h" |
[email protected] | 96361d0 | 2013-05-08 18:26:18 | [diff] [blame] | 19 | #include "remoting/host/curtain_mode.h" |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 20 | #include "remoting/host/desktop_resizer.h" |
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame] | 21 | #include "remoting/host/host_window.h" |
[email protected] | ac115ce | 2013-04-24 20:44:38 | [diff] [blame] | 22 | #include "remoting/host/host_window_proxy.h" |
sergeyu | b3e637e | 2016-10-27 23:31:21 | [diff] [blame] | 23 | #include "remoting/host/input_injector.h" |
Joe Downing | 4dfb389 | 2018-08-24 18:56:06 | [diff] [blame] | 24 | #include "remoting/host/input_monitor/local_input_monitor.h" |
Yuwei Huang | 6df36ef | 2021-09-15 18:48:06 | [diff] [blame] | 25 | #include "remoting/host/remote_open_url/remote_open_url_util.h" |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 26 | #include "remoting/host/resizing_host_observer.h" |
rkuroiwa | a7815e7 | 2015-06-05 21:39:04 | [diff] [blame] | 27 | #include "remoting/protocol/capability_names.h" |
[email protected] | cd808805 | 2013-10-15 02:39:02 | [diff] [blame] | 28 | #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
zijiehe | a69c784 | 2016-11-11 01:28:20 | [diff] [blame] | 29 | #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
[email protected] | ac115ce | 2013-04-24 20:44:38 | [diff] [blame] | 30 | |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 31 | #if BUILDFLAG(IS_POSIX) |
[email protected] | ac115ce | 2013-04-24 20:44:38 | [diff] [blame] | 32 | #include <sys/types.h> |
| 33 | #include <unistd.h> |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 34 | #endif // BUILDFLAG(IS_POSIX) |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 35 | |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 36 | #if BUILDFLAG(IS_WIN) |
Joe Downing | b511e4a9 | 2018-11-16 21:10:13 | [diff] [blame] | 37 | #include "base/win/windows_version.h" |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 38 | #endif // BUILDFLAG(IS_WIN) |
Joe Downing | b511e4a9 | 2018-11-16 21:10:13 | [diff] [blame] | 39 | |
Yuwei Huang | 0b237c4cb | 2022-09-23 22:58:54 | [diff] [blame] | 40 | #if defined(REMOTING_USE_X11) |
Salman | 394895180 | 2023-01-19 13:13:40 | [diff] [blame] | 41 | #include "remoting/host/linux/wayland_utils.h" |
Yuwei Huang | 0b237c4cb | 2022-09-23 22:58:54 | [diff] [blame] | 42 | #include "remoting/host/linux/x11_util.h" |
| 43 | #include "ui/gfx/x/connection.h" |
| 44 | #endif // defined(REMOTING_USE_X11) |
| 45 | |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 46 | namespace remoting { |
| 47 | |
Yuwei Huang | c7ec1c0 | 2022-09-22 22:09:29 | [diff] [blame] | 48 | namespace { |
| 49 | |
Yuwei Huang | 0b237c4cb | 2022-09-23 22:58:54 | [diff] [blame] | 50 | #if defined(REMOTING_USE_X11) |
Yuwei Huang | c7ec1c0 | 2022-09-22 22:09:29 | [diff] [blame] | 51 | |
Yuwei Huang | 0b237c4cb | 2022-09-23 22:58:54 | [diff] [blame] | 52 | // Helper function that caches the result of IsUsingVideoDummyDriver(). |
| 53 | bool UsingVideoDummyDriver() { |
| 54 | static bool is_using_dummy_driver = |
| 55 | IsUsingVideoDummyDriver(x11::Connection::Get()); |
| 56 | return is_using_dummy_driver; |
| 57 | } |
Yuwei Huang | c7ec1c0 | 2022-09-22 22:09:29 | [diff] [blame] | 58 | |
Yuwei Huang | 0b237c4cb | 2022-09-23 22:58:54 | [diff] [blame] | 59 | #endif // defined(REMOTING_USE_X11) |
Yuwei Huang | c7ec1c0 | 2022-09-22 22:09:29 | [diff] [blame] | 60 | |
| 61 | } // namespace |
| 62 | |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 63 | Me2MeDesktopEnvironment::~Me2MeDesktopEnvironment() { |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 64 | DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 65 | } |
| 66 | |
Joe Downing | 505ae0d0 | 2018-10-17 17:47:30 | [diff] [blame] | 67 | std::unique_ptr<ActionExecutor> |
| 68 | Me2MeDesktopEnvironment::CreateActionExecutor() { |
| 69 | DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 70 | |
| 71 | return ActionExecutor::Create(); |
| 72 | } |
| 73 | |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 74 | std::unique_ptr<ScreenControls> |
| 75 | Me2MeDesktopEnvironment::CreateScreenControls() { |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 76 | DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 77 | |
rkjnsn | 5d5d89b9 | 2016-06-07 21:34:21 | [diff] [blame] | 78 | // We only want to restore the host resolution on disconnect if we are not |
| 79 | // curtained so we don't mess up the user's window layout unnecessarily if |
| 80 | // they disconnect and reconnect. Both OS X and Windows will restore the |
| 81 | // resolution automatically when the user logs back in on the console, and on |
| 82 | // Linux the curtain-mode uses a separate session. |
Lambros Lambrou | d27736d | 2022-06-16 00:52:27 | [diff] [blame] | 83 | auto resizer = std::make_unique<ResizingHostObserver>( |
| 84 | DesktopResizer::Create(), curtain_ == nullptr); |
| 85 | resizer->RegisterForDisplayChanges(*GetDisplayInfoMonitor()); |
| 86 | return resizer; |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 87 | } |
| 88 | |
[email protected] | 4a444c4 | 2013-06-09 01:43:14 | [diff] [blame] | 89 | std::string Me2MeDesktopEnvironment::GetCapabilities() const { |
Lambros Lambrou | f9a02aaf | 2022-03-29 00:39:42 | [diff] [blame] | 90 | std::string capabilities = BasicDesktopEnvironment::GetCapabilities(); |
| 91 | if (!capabilities.empty()) { |
| 92 | capabilities += " "; |
| 93 | } |
sergeyu | b3e637e | 2016-10-27 23:31:21 | [diff] [blame] | 94 | capabilities += protocol::kRateLimitResizeRequests; |
Lambros Lambrou | 4c46dcb0 | 2020-07-22 18:14:54 | [diff] [blame] | 95 | |
sergeyu | b3e637e | 2016-10-27 23:31:21 | [diff] [blame] | 96 | if (InputInjector::SupportsTouchEvents()) { |
| 97 | capabilities += " "; |
| 98 | capabilities += protocol::kTouchEventsCapability; |
| 99 | } |
Joseph Arhar | e76c304 | 2017-08-03 02:01:13 | [diff] [blame] | 100 | |
Joseph Arhar | 111ddceb | 2017-09-01 04:57:30 | [diff] [blame] | 101 | if (desktop_environment_options().enable_file_transfer()) { |
| 102 | capabilities += " "; |
| 103 | capabilities += protocol::kFileTransferCapability; |
| 104 | } |
Joseph Arhar | e76c304 | 2017-08-03 02:01:13 | [diff] [blame] | 105 | |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 106 | #if BUILDFLAG(IS_WIN) |
Joe Downing | b511e4a9 | 2018-11-16 21:10:13 | [diff] [blame] | 107 | capabilities += " "; |
| 108 | capabilities += protocol::kSendAttentionSequenceAction; |
| 109 | |
| 110 | if (base::win::OSInfo::GetInstance()->version_type() != |
| 111 | base::win::VersionType::SUITE_HOME) { |
| 112 | capabilities += " "; |
| 113 | capabilities += protocol::kLockWorkstationAction; |
| 114 | } |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 115 | #endif // BUILDFLAG(IS_WIN) |
Joe Downing | b511e4a9 | 2018-11-16 21:10:13 | [diff] [blame] | 116 | |
Yuwei Huang | c31b4d7 | 2021-09-13 23:04:49 | [diff] [blame] | 117 | if (desktop_environment_options().enable_remote_open_url() && |
| 118 | IsRemoteOpenUrlSupported()) { |
Yuwei Huang | c4927979 | 2021-07-22 23:31:48 | [diff] [blame] | 119 | capabilities += " "; |
| 120 | capabilities += protocol::kRemoteOpenUrlCapability; |
| 121 | } |
Yuwei Huang | 9d0cb6dc | 2021-05-10 21:04:51 | [diff] [blame] | 122 | |
Yuwei Huang | 78b3fc5 | 2021-10-20 21:03:24 | [diff] [blame] | 123 | if (desktop_environment_options().enable_remote_webauthn()) { |
| 124 | capabilities += " "; |
| 125 | capabilities += protocol::kRemoteWebAuthnCapability; |
| 126 | } |
| 127 | |
Lambros Lambrou | bbb4e16 | 2022-12-12 23:14:46 | [diff] [blame] | 128 | #if BUILDFLAG(IS_LINUX) && defined(REMOTING_USE_X11) |
Salman | 394895180 | 2023-01-19 13:13:40 | [diff] [blame] | 129 | if (!IsRunningWayland()) { |
Yuwei Huang | c7ec1c0 | 2022-09-22 22:09:29 | [diff] [blame] | 130 | capabilities += " "; |
Salman | 394895180 | 2023-01-19 13:13:40 | [diff] [blame] | 131 | capabilities += protocol::kMultiStreamCapability; |
| 132 | |
| 133 | // Client-controlled layout is only supported with Xorg+video-dummy. |
| 134 | if (UsingVideoDummyDriver()) { |
| 135 | capabilities += " "; |
| 136 | capabilities += protocol::kClientControlledLayoutCapability; |
| 137 | } |
Yuwei Huang | c7ec1c0 | 2022-09-22 22:09:29 | [diff] [blame] | 138 | } |
Salman Malik | 46a0f06 | 2022-11-08 17:28:23 | [diff] [blame] | 139 | #endif // BUILDFLAG(IS_LINUX) && defined(REMOTING_USE_X11) |
Lambros Lambrou | fc279d8 | 2022-09-21 18:37:39 | [diff] [blame] | 140 | |
rkuroiwa | a7815e7 | 2015-06-05 21:39:04 | [diff] [blame] | 141 | return capabilities; |
[email protected] | 4a444c4 | 2013-06-09 01:43:14 | [diff] [blame] | 142 | } |
| 143 | |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 144 | Me2MeDesktopEnvironment::Me2MeDesktopEnvironment( |
| 145 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
sergeyu | 85df3c48 | 2016-02-15 05:59:08 | [diff] [blame] | 146 | scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 147 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 148 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
Gary Kacmarcik | a7e33e4 | 2019-02-22 19:23:28 | [diff] [blame] | 149 | base::WeakPtr<ClientSessionControl> client_session_control, |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 150 | const DesktopEnvironmentOptions& options) |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 151 | : BasicDesktopEnvironment(caller_task_runner, |
sergeyu | 85df3c48 | 2016-02-15 05:59:08 | [diff] [blame] | 152 | video_capture_task_runner, |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 153 | input_task_runner, |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 154 | ui_task_runner, |
Gary Kacmarcik | a7e33e4 | 2019-02-22 19:23:28 | [diff] [blame] | 155 | client_session_control, |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 156 | options) { |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 157 | DCHECK(caller_task_runner->BelongsToCurrentThread()); |
sergeyu | 85df3c48 | 2016-02-15 05:59:08 | [diff] [blame] | 158 | |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 159 | // TODO(zijiehe): This logic should belong to RemotingMe2MeHost, instead of |
| 160 | // Me2MeDesktopEnvironment, which does not take response to create a new |
| 161 | // session. |
sergeyu | 85df3c48 | 2016-02-15 05:59:08 | [diff] [blame] | 162 | // X DAMAGE is not enabled by default, since it is broken on many systems - |
| 163 | // see http://crbug.com/73423. It's safe to enable it here because it works |
| 164 | // properly under Xvfb. |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 165 | mutable_desktop_capture_options()->set_use_update_notifications(true); |
Joe Downing | 3588e23 | 2022-11-18 23:30:16 | [diff] [blame] | 166 | |
| 167 | #if BUILDFLAG(IS_LINUX) |
| 168 | // Setting this option to false means that the capture differ wrapper will not |
| 169 | // be used when the X11 capturer is selected. This reduces the X11 capture |
| 170 | // time by a few milliseconds per frame and is safe because we can rely on |
| 171 | // XDAMAGE to identify the changed regions rather than checking each pixel |
| 172 | // ourselves. |
| 173 | mutable_desktop_capture_options()->set_detect_updated_region(false); |
| 174 | #endif |
Salman | 1c8dcf2 | 2022-11-28 15:53:21 | [diff] [blame] | 175 | |
Salman | 394895180 | 2023-01-19 13:13:40 | [diff] [blame] | 176 | #if BUILDFLAG(IS_LINUX) |
| 177 | if (IsRunningWayland()) { |
| 178 | mutable_desktop_capture_options()->set_prefer_cursor_embedded(false); |
| 179 | } |
Salman | 1c8dcf2 | 2022-11-28 15:53:21 | [diff] [blame] | 180 | #endif |
[email protected] | 96361d0 | 2013-05-08 18:26:18 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | bool Me2MeDesktopEnvironment::InitializeSecurity( |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 184 | base::WeakPtr<ClientSessionControl> client_session_control) { |
[email protected] | 96361d0 | 2013-05-08 18:26:18 | [diff] [blame] | 185 | DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 186 | |
| 187 | // Detach the session from the local console if the caller requested. |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 188 | if (desktop_environment_options().enable_curtaining()) { |
Joe Downing | fd8a422 | 2023-01-11 23:39:40 | [diff] [blame] | 189 | curtain_ = CurtainMode::Create(caller_task_runner(), ui_task_runner(), |
| 190 | client_session_control); |
rkjnsn | 5d5d89b9 | 2016-06-07 21:34:21 | [diff] [blame] | 191 | if (!curtain_->Activate()) { |
[email protected] | 04eca61 | 2013-05-15 04:02:25 | [diff] [blame] | 192 | LOG(ERROR) << "Failed to activate the curtain mode."; |
rkjnsn | 5d5d89b9 | 2016-06-07 21:34:21 | [diff] [blame] | 193 | curtain_ = nullptr; |
| 194 | return false; |
| 195 | } |
| 196 | return true; |
[email protected] | 96361d0 | 2013-05-08 18:26:18 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | // Otherwise, if the session is shared with the local user start monitoring |
| 200 | // the local input and create the in-session UI. |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 201 | #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) |
[email protected] | 04eca61 | 2013-05-15 04:02:25 | [diff] [blame] | 202 | bool want_user_interface = false; |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 203 | #elif BUILDFLAG(IS_APPLE) |
[email protected] | ac115ce | 2013-04-24 20:44:38 | [diff] [blame] | 204 | // Don't try to display any UI on top of the system's login screen as this |
| 205 | // is rejected by the Window Server on OS X 10.7.4, and prevents the |
| 206 | // capturer from working (http://crbug.com/140984). |
| 207 | |
| 208 | // TODO(lambroslambrou): Use a better technique of detecting whether we're |
| 209 | // running in the LoginWindow context, and refactor this into a separate |
| 210 | // function to be used here and in CurtainMode::ActivateCurtain(). |
[email protected] | 04eca61 | 2013-05-15 04:02:25 | [diff] [blame] | 211 | bool want_user_interface = getuid() != 0; |
lambroslambrou | 51e19b9 | 2016-04-13 21:30:41 | [diff] [blame] | 212 | #else |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 213 | bool want_user_interface = |
| 214 | desktop_environment_options().enable_user_interface(); |
lambroslambrou | 51e19b9 | 2016-04-13 21:30:41 | [diff] [blame] | 215 | #endif |
[email protected] | ac115ce | 2013-04-24 20:44:38 | [diff] [blame] | 216 | |
[email protected] | ac115ce | 2013-04-24 20:44:38 | [diff] [blame] | 217 | if (want_user_interface) { |
[email protected] | 04eca61 | 2013-05-15 04:02:25 | [diff] [blame] | 218 | // Create the local input monitor. |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 219 | local_input_monitor_ = LocalInputMonitor::Create( |
Joe Downing | f86c8a01 | 2018-08-29 16:49:04 | [diff] [blame] | 220 | caller_task_runner(), input_task_runner(), ui_task_runner()); |
| 221 | local_input_monitor_->StartMonitoringForClientSession( |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 222 | client_session_control); |
[email protected] | 04eca61 | 2013-05-15 04:02:25 | [diff] [blame] | 223 | |
Joe Downing | f86c8a01 | 2018-08-29 16:49:04 | [diff] [blame] | 224 | // Create the disconnect window. |
Xiaohan Wang | 453b3867 | 2022-01-13 20:02:44 | [diff] [blame] | 225 | #if BUILDFLAG(IS_WIN) |
Joe Downing | 8e95ed18 | 2018-08-30 22:57:19 | [diff] [blame] | 226 | disconnect_window_ = |
| 227 | HostWindow::CreateAutoHidingDisconnectWindow(LocalInputMonitor::Create( |
| 228 | caller_task_runner(), input_task_runner(), ui_task_runner())); |
| 229 | #else |
[email protected] | fc877cf | 2013-07-31 23:08:39 | [diff] [blame] | 230 | disconnect_window_ = HostWindow::CreateDisconnectWindow(); |
Joe Downing | 8e95ed18 | 2018-08-30 22:57:19 | [diff] [blame] | 231 | #endif |
Peter Boström | 42afa23f | 2021-04-02 22:10:46 | [diff] [blame] | 232 | disconnect_window_ = std::make_unique<HostWindowProxy>( |
| 233 | caller_task_runner(), ui_task_runner(), std::move(disconnect_window_)); |
[email protected] | ac115ce | 2013-04-24 20:44:38 | [diff] [blame] | 234 | disconnect_window_->Start(client_session_control); |
| 235 | } |
[email protected] | 96361d0 | 2013-05-08 18:26:18 | [diff] [blame] | 236 | |
| 237 | return true; |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 238 | } |
| 239 | |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 240 | Me2MeDesktopEnvironmentFactory::Me2MeDesktopEnvironmentFactory( |
| 241 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
sergeyu | 85df3c48 | 2016-02-15 05:59:08 | [diff] [blame] | 242 | scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 243 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
Scott Violet | 9778dcd | 2019-06-20 21:59:37 | [diff] [blame] | 244 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 245 | : BasicDesktopEnvironmentFactory(caller_task_runner, |
sergeyu | 85df3c48 | 2016-02-15 05:59:08 | [diff] [blame] | 246 | video_capture_task_runner, |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 247 | input_task_runner, |
Scott Violet | 9778dcd | 2019-06-20 21:59:37 | [diff] [blame] | 248 | ui_task_runner) {} |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 249 | |
Joe Downing | fd8a422 | 2023-01-11 23:39:40 | [diff] [blame] | 250 | Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() = default; |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 251 | |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 252 | std::unique_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 253 | base::WeakPtr<ClientSessionControl> client_session_control, |
Yuwei Huang | 3628aa5 | 2021-12-08 23:00:55 | [diff] [blame] | 254 | base::WeakPtr<ClientSessionEvents> client_session_events, |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 255 | const DesktopEnvironmentOptions& options) { |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 256 | DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 257 | |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 258 | std::unique_ptr<Me2MeDesktopEnvironment> desktop_environment( |
Scott Violet | 9778dcd | 2019-06-20 21:59:37 | [diff] [blame] | 259 | new Me2MeDesktopEnvironment(caller_task_runner(), |
| 260 | video_capture_task_runner(), |
| 261 | input_task_runner(), ui_task_runner(), |
| 262 | client_session_control, options)); |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 263 | if (!desktop_environment->InitializeSecurity(client_session_control)) { |
sergeyu | afce978 | 2014-09-29 19:38:30 | [diff] [blame] | 264 | return nullptr; |
[email protected] | 96361d0 | 2013-05-08 18:26:18 | [diff] [blame] | 265 | } |
| 266 | |
Jeroen Dhollander | a3ce38f | 2022-08-25 07:18:02 | [diff] [blame] | 267 | return desktop_environment; |
[email protected] | 96361d0 | 2013-05-08 18:26:18 | [diff] [blame] | 268 | } |
| 269 | |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 270 | } // namespace remoting |