manifests.cc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "atom/app/manifests.h"
  5. #include "base/no_destructor.h"
  6. #include "electron/atom/common/api/api.mojom.h"
  7. #include "printing/buildflags/buildflags.h"
  8. #include "services/proxy_resolver/public/cpp/manifest.h"
  9. #include "services/service_manager/public/cpp/manifest_builder.h"
  10. #if BUILDFLAG(ENABLE_PRINTING)
  11. #include "components/services/pdf_compositor/public/cpp/manifest.h"
  12. #endif
  13. #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
  14. #include "chrome/services/printing/public/cpp/manifest.h"
  15. #endif
  16. namespace {
  17. // TODO(https://crbug.com/781334): Remove these helpers and just update the
  18. // manifest definitions to be marked out-of-process. This is here only to avoid
  19. // extra churn when transitioning away from content_packaged_services.
  20. service_manager::Manifest MakeOutOfProcess(
  21. const service_manager::Manifest& manifest) {
  22. // cpplint.py emits a false positive [build/include_what_you_use]
  23. service_manager::Manifest copy(manifest); // NOLINT
  24. copy.options.execution_mode =
  25. service_manager::Manifest::ExecutionMode::kOutOfProcessBuiltin;
  26. return copy;
  27. }
  28. } // namespace
  29. const service_manager::Manifest& GetElectronContentBrowserOverlayManifest() {
  30. static base::NoDestructor<service_manager::Manifest> manifest{
  31. service_manager::ManifestBuilder()
  32. .WithDisplayName("Electron (browser process)")
  33. .RequireCapability("device", "device:geolocation_control")
  34. .RequireCapability("proxy_resolver", "factory")
  35. .RequireCapability("chrome_printing", "converter")
  36. .RequireCapability("pdf_compositor", "compositor")
  37. .ExposeInterfaceFilterCapability_Deprecated(
  38. "navigation:frame", "renderer",
  39. service_manager::Manifest::InterfaceList<
  40. atom::mojom::ElectronBrowser>())
  41. .Build()};
  42. return *manifest;
  43. }
  44. const std::vector<service_manager::Manifest>&
  45. GetElectronBuiltinServiceManifests() {
  46. static base::NoDestructor<std::vector<service_manager::Manifest>> manifests{{
  47. MakeOutOfProcess(proxy_resolver::GetManifest()),
  48. #if BUILDFLAG(ENABLE_PRINTING)
  49. MakeOutOfProcess(printing::GetPdfCompositorManifest()),
  50. #endif
  51. #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
  52. MakeOutOfProcess(GetChromePrintingManifest()),
  53. #endif
  54. }};
  55. return *manifests;
  56. }