1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
--- remoting/host/remoting_me2me_host.cc.orig 2022-03-25 21:59:56 UTC
+++ remoting/host/remoting_me2me_host.cc
@@ -124,7 +124,7 @@
#include "remoting/host/mac/permission_utils.h"
#endif // BUILDFLAG(IS_APPLE)
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
#include <gtk/gtk.h>
#include "base/linux_util.h"
@@ -168,7 +168,7 @@ const char kApplicationName[] = "chromoting";
const char kStdinConfigPath[] = "-";
#endif // !defined(REMOTING_MULTI_PROCESS)
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
// The command line switch used to pass name of the pipe to capture audio on
// linux.
const char kAudioPipeSwitchName[] = "audio-pipe-name";
@@ -373,7 +373,7 @@ class HostProcess : public ConfigWatcher::Delegate,
std::unique_ptr<ChromotingHostContext> context_;
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
// Watch for certificate changes and kill the host when changes occur
std::unique_ptr<CertificateWatcher> cert_watcher_;
#endif
@@ -747,7 +747,7 @@ void HostProcess::StartOnNetworkThread() {
void HostProcess::ShutdownOnNetworkThread() {
DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
config_watcher_.reset();
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
cert_watcher_.reset();
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
}
@@ -806,7 +806,7 @@ void HostProcess::CreateAuthenticatorFactory() {
DCHECK(third_party_auth_config_.token_url.is_valid());
DCHECK(third_party_auth_config_.token_validation_url.is_valid());
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
if (!cert_watcher_) {
cert_watcher_ = std::make_unique<CertificateWatcher>(
base::BindRepeating(&HostProcess::ShutdownHost,
@@ -916,7 +916,7 @@ void HostProcess::StartOnUiThread() {
base::BindRepeating(&HostProcess::OnPolicyUpdate, base::Unretained(this)),
base::BindRepeating(&HostProcess::OnPolicyError, base::Unretained(this)));
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
// If an audio pipe is specific on the command-line then initialize
// AudioCapturerLinux to capture from it.
base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()->
@@ -987,7 +987,7 @@ void HostProcess::ShutdownOnUiThread() {
// It is now safe for the HostProcess to be deleted.
self_ = nullptr;
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
// Cause the global AudioPipeReader to be freed, otherwise the audio
// thread will remain in-use and prevent the process from exiting.
// TODO(wez): DesktopEnvironmentFactory should own the pipe reader.
@@ -1697,7 +1697,7 @@ void HostProcess::StartHost() {
// The feature is enabled for all Googlers using a supported platform.
desktop_environment_options_.set_enable_remote_open_url(is_googler_);
-#if BUILDFLAG(IS_LINUX) || !defined(NDEBUG)
+#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || !defined(NDEBUG)
// Experimental feature. Enabled on Linux for easier testing.
if (is_googler_) {
desktop_environment_options_.set_enable_remote_webauthn(true);
@@ -1897,7 +1897,7 @@ int HostProcessMain() {
HOST_LOG << "Starting host process: version " << STRINGIZE(VERSION);
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
// Initialize Xlib for multi-threaded use, allowing non-Chromium code to
// use X11 safely (such as the WebRTC capturer, GTK ...)
x11::InitXlib();
@@ -1941,7 +1941,7 @@ int HostProcessMain() {
std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier(
net::NetworkChangeNotifier::CreateIfNeeded());
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
// Create an X11EventSource on all UI threads, so the global X11 connection
// (x11::Connection::Get()) can dispatch X events.
auto event_source =
|