#include "build/build_config.h"
#include "content/browser/service_host/utility_process_host.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "media/media_buildflags.h"
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include "components/services/font/public/mojom/font_service.mojom.h"
#include "content/browser/font_service.h"
#endif
#if BUILDFLAG(ENABLE_GPU_CHANNEL_MEDIA_CAPTURE)
#include "components/viz/host/gpu_client.h"
#include "content/public/browser/gpu_client.h"
#endif
namespace content {
void UtilityProcessHost::BindHostReceiver(
mojo::GenericPendingReceiver receiver) {
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
if (auto font_receiver = receiver.As<font_service::mojom::FontService>()) {
ConnectToFontService(std::move(font_receiver));
return;
}
#endif
#if BUILDFLAG(ENABLE_GPU_CHANNEL_MEDIA_CAPTURE)
if (options_.allowed_gpu_) {
if (auto gpu_receiver = receiver.As<viz::mojom::Gpu>()) {
gpu_client_ = content::CreateGpuClient(
std::move(gpu_receiver), false);
return;
}
}
#endif
GetContentClient()->browser()->BindUtilityHostReceiver(std::move(receiver));
}
}