chore: use c++ manifests instead of json
This commit is contained in:
parent
cece8bce0b
commit
d7557cb66a
8 changed files with 93 additions and 58 deletions
26
BUILD.gn
26
BUILD.gn
|
@ -2,7 +2,6 @@ import("//build/config/locales.gni")
|
||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//build/config/win/manifest.gni")
|
import("//build/config/win/manifest.gni")
|
||||||
import("//pdf/features.gni")
|
import("//pdf/features.gni")
|
||||||
import("//services/service_manager/public/service_manifest.gni")
|
|
||||||
import("//third_party/ffmpeg/ffmpeg_options.gni")
|
import("//third_party/ffmpeg/ffmpeg_options.gni")
|
||||||
import("//tools/generate_library_loader/generate_library_loader.gni")
|
import("//tools/generate_library_loader/generate_library_loader.gni")
|
||||||
import("//tools/grit/grit_rule.gni")
|
import("//tools/grit/grit_rule.gni")
|
||||||
|
@ -281,7 +280,6 @@ grit("resources") {
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":copy_shell_devtools_discovery_page",
|
":copy_shell_devtools_discovery_page",
|
||||||
":electron_content_manifest_overlays",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
output_dir = "$target_gen_dir"
|
output_dir = "$target_gen_dir"
|
||||||
|
@ -330,6 +328,7 @@ static_library("electron_lib") {
|
||||||
":atom_js2c",
|
":atom_js2c",
|
||||||
"buildflags",
|
"buildflags",
|
||||||
"chromium_src:chrome",
|
"chromium_src:chrome",
|
||||||
|
"manifests",
|
||||||
"native_mate",
|
"native_mate",
|
||||||
"//base",
|
"//base",
|
||||||
"//base:base_static",
|
"//base:base_static",
|
||||||
|
@ -1055,26 +1054,3 @@ group("electron") {
|
||||||
":electron_app",
|
":electron_app",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
group("electron_content_manifest_overlays") {
|
|
||||||
deps = [
|
|
||||||
":electron_content_browser_manifest_overlay",
|
|
||||||
":electron_content_packaged_services_manifest_overlay",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
service_manifest("electron_content_packaged_services_manifest_overlay") {
|
|
||||||
source = "//electron/manifests/electron_content_packaged_services_manifest_overlay.json"
|
|
||||||
packaged_services = [ "//services/proxy_resolver:proxy_resolver_manifest" ]
|
|
||||||
|
|
||||||
if (enable_basic_printing) {
|
|
||||||
packaged_services += [
|
|
||||||
"//chrome/services/printing:manifest",
|
|
||||||
"//components/services/pdf_compositor:pdf_compositor_manifest",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
service_manifest("electron_content_browser_manifest_overlay") {
|
|
||||||
source = "//electron/manifests/electron_content_browser_manifest_overlay.json"
|
|
||||||
}
|
|
||||||
|
|
44
atom/app/manifests.cc
Normal file
44
atom/app/manifests.cc
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// Copyright (c) 2019 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/app/manifests.h"
|
||||||
|
|
||||||
|
#include "base/no_destructor.h"
|
||||||
|
#include "printing/buildflags/buildflags.h"
|
||||||
|
#include "services/proxy_resolver/proxy_resolver_manifest.h"
|
||||||
|
#include "services/service_manager/public/cpp/manifest_builder.h"
|
||||||
|
|
||||||
|
#if BUILDFLAG(ENABLE_PRINTING)
|
||||||
|
#include "components/services/pdf_compositor/pdf_compositor_manifest.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||||
|
#include "chrome/services/printing/manifest.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const service_manager::Manifest& GetElectronContentBrowserOverlayManifest() {
|
||||||
|
static base::NoDestructor<service_manager::Manifest> manifest{
|
||||||
|
service_manager::ManifestBuilder()
|
||||||
|
.WithDisplayName("Electron (browser process)")
|
||||||
|
.RequireCapability("device", "device:geolocation_control")
|
||||||
|
.RequireCapability("proxy_resolver", "factory")
|
||||||
|
.RequireCapability("chrome_printing", "converter")
|
||||||
|
.RequireCapability("pdf_compositor", "compositor")
|
||||||
|
.Build()};
|
||||||
|
return *manifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<service_manager::Manifest>&
|
||||||
|
GetElectronPackagedServicesOverlayManifest() {
|
||||||
|
static base::NoDestructor<std::vector<service_manager::Manifest>> manifests{{
|
||||||
|
proxy_resolver::GetManifest(),
|
||||||
|
#if BUILDFLAG(ENABLE_PRINTING)
|
||||||
|
pdf_compositor::GetManifest(),
|
||||||
|
#endif
|
||||||
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||||
|
chrome_printing::GetManifest(),
|
||||||
|
#endif
|
||||||
|
}};
|
||||||
|
return *manifests;
|
||||||
|
}
|
16
atom/app/manifests.h
Normal file
16
atom/app/manifests.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright (c) 2019 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef ATOM_APP_MANIFESTS_H_
|
||||||
|
#define ATOM_APP_MANIFESTS_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "services/service_manager/public/cpp/manifest.h"
|
||||||
|
|
||||||
|
const service_manager::Manifest& GetElectronContentBrowserOverlayManifest();
|
||||||
|
const std::vector<service_manager::Manifest>&
|
||||||
|
GetElectronPackagedServicesOverlayManifest();
|
||||||
|
|
||||||
|
#endif // ATOM_APP_MANIFESTS_H_
|
|
@ -11,6 +11,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "atom/app/manifests.h"
|
||||||
#include "atom/browser/api/atom_api_app.h"
|
#include "atom/browser/api/atom_api_app.h"
|
||||||
#include "atom/browser/api/atom_api_protocol.h"
|
#include "atom/browser/api/atom_api_protocol.h"
|
||||||
#include "atom/browser/api/atom_api_web_contents.h"
|
#include "atom/browser/api/atom_api_web_contents.h"
|
||||||
|
@ -716,19 +717,15 @@ void AtomBrowserClient::RegisterOutOfProcessServices(
|
||||||
|
|
||||||
base::Optional<service_manager::Manifest>
|
base::Optional<service_manager::Manifest>
|
||||||
AtomBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
|
AtomBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
|
||||||
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
if (name == content::mojom::kBrowserServiceName) {
|
||||||
int id = -1;
|
return GetElectronContentBrowserOverlayManifest();
|
||||||
if (name == content::mojom::kBrowserServiceName)
|
} else if (name == content::mojom::kPackagedServicesServiceName) {
|
||||||
id = IDR_ELECTRON_CONTENT_BROWSER_MANIFEST_OVERLAY;
|
service_manager::Manifest overlay;
|
||||||
else if (name == content::mojom::kPackagedServicesServiceName)
|
overlay.packaged_services = GetElectronPackagedServicesOverlayManifest();
|
||||||
id = IDR_ELECTRON_CONTENT_PACKAGED_SERVICES_MANIFEST_OVERLAY;
|
return overlay;
|
||||||
|
}
|
||||||
|
|
||||||
if (id == -1)
|
|
||||||
return base::nullopt;
|
return base::nullopt;
|
||||||
|
|
||||||
base::StringPiece manifest_contents = rb.GetRawDataResource(id);
|
|
||||||
return service_manager::Manifest::FromValueDeprecated(
|
|
||||||
base::JSONReader::Read(manifest_contents));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
net::NetLog* AtomBrowserClient::GetNetLog() {
|
net::NetLog* AtomBrowserClient::GetNetLog() {
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
<part file="electron_strings.grdp" />
|
<part file="electron_strings.grdp" />
|
||||||
</messages>
|
</messages>
|
||||||
<includes>
|
<includes>
|
||||||
<include name="IDR_ELECTRON_CONTENT_BROWSER_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_browser_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
|
||||||
<include name="IDR_ELECTRON_CONTENT_PACKAGED_SERVICES_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_packaged_services_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
|
||||||
<include name="IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE" file="${target_gen_dir}\shell_devtools_discovery_page.html" use_base_dir="false" type="BINDATA" />
|
<include name="IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE" file="${target_gen_dir}\shell_devtools_discovery_page.html" use_base_dir="false" type="BINDATA" />
|
||||||
</includes>
|
</includes>
|
||||||
</release>
|
</release>
|
||||||
|
|
23
manifests/BUILD.gn
Normal file
23
manifests/BUILD.gn
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import("//printing/buildflags/buildflags.gni")
|
||||||
|
|
||||||
|
source_set("manifests") {
|
||||||
|
sources = [
|
||||||
|
"//electron/atom/app/manifests.cc",
|
||||||
|
"//electron/atom/app/manifests.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
include_dirs = [ "//electron" ]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"//printing/buildflags",
|
||||||
|
"//services/proxy_resolver:proxy_resolver_manifest",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (enable_basic_printing) {
|
||||||
|
deps += [ "//components/services/pdf_compositor:pdf_compositor_manifest" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enable_print_preview) {
|
||||||
|
deps += [ "//chrome/services/printing:manifest" ]
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"name": "content_browser",
|
|
||||||
"display_name": "Electron (browser process)",
|
|
||||||
"interface_provider_specs": {
|
|
||||||
"service_manager:connector": {
|
|
||||||
"requires": {
|
|
||||||
"device": [ "device:geolocation_control" ],
|
|
||||||
"proxy_resolver": [ "factory" ],
|
|
||||||
"chrome_printing": [ "converter" ],
|
|
||||||
"pdf_compositor": [ "compositor"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"name": "content_packaged_services",
|
|
||||||
"display_name": "Electron Packaged Services",
|
|
||||||
"interface_provider_specs": {}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue