Skip to content

Commit ffb96ac

Browse files
miniakcodebytere
authored andcommitted
fix: when building with enable_plugins=false (electron#20354) (electron#20508)
1 parent fd0b57f commit ffb96ac

File tree

4 files changed

+88
-2
lines changed

4 files changed

+88
-2
lines changed

atom/app/atom_content_client.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
#include "base/strings/string_util.h"
1616
#include "base/strings/utf_string_conversions.h"
1717
#include "content/public/common/content_constants.h"
18-
#include "content/public/common/pepper_plugin_info.h"
1918
#include "electron/buildflags/buildflags.h"
20-
#include "ppapi/shared_impl/ppapi_permissions.h"
19+
#include "ppapi/buildflags/buildflags.h"
2120
#include "ui/base/l10n/l10n_util.h"
2221
#include "ui/base/resource/resource_bundle.h"
2322
#include "url/url_constants.h"
@@ -35,6 +34,11 @@
3534
#include "pdf/pdf.h"
3635
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
3736

37+
#if BUILDFLAG(ENABLE_PLUGINS)
38+
#include "content/public/common/pepper_plugin_info.h"
39+
#include "ppapi/shared_impl/ppapi_permissions.h"
40+
#endif // BUILDFLAG(ENABLE_PLUGINS)
41+
3842
namespace atom {
3943

4044
namespace {
@@ -141,6 +145,7 @@ void AddPepperFlashFromCommandLine(
141145
}
142146
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
143147

148+
#if BUILDFLAG(ENABLE_PLUGINS)
144149
void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
145150
#if BUILDFLAG(ENABLE_PDF_VIEWER)
146151
content::PepperPluginInfo pdf_info;
@@ -161,6 +166,7 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
161166
plugins->push_back(pdf_info);
162167
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
163168
}
169+
#endif // BUILDFLAG(ENABLE_PLUGINS)
164170

165171
void AppendDelimitedSwitchToVector(const base::StringPiece cmd_switch,
166172
std::vector<std::string>* append_me) {
@@ -227,7 +233,9 @@ void AtomContentClient::AddPepperPlugins(
227233
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
228234
AddPepperFlashFromCommandLine(command_line, plugins);
229235
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
236+
#if BUILDFLAG(ENABLE_PLUGINS)
230237
ComputeBuiltInPlugins(plugins);
238+
#endif // BUILDFLAG(ENABLE_PLUGINS)
231239
}
232240

233241
void AtomContentClient::AddContentDecryptionModules(

atom/browser/api/atom_api_web_contents.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
#include "native_mate/dictionary.h"
8686
#include "native_mate/object_template_builder.h"
8787
#include "net/url_request/url_request_context.h"
88+
#include "ppapi/buildflags/buildflags.h"
8889
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
8990
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
9091
#include "third_party/blink/public/platform/web_cursor_info.h"
@@ -833,10 +834,12 @@ void WebContents::RenderProcessGone(base::TerminationStatus status) {
833834

834835
void WebContents::PluginCrashed(const base::FilePath& plugin_path,
835836
base::ProcessId plugin_pid) {
837+
#if BUILDFLAG(ENABLE_PLUGINS)
836838
content::WebPluginInfo info;
837839
auto* plugin_service = content::PluginService::GetInstance();
838840
plugin_service->GetPluginInfoByPath(plugin_path, &info);
839841
Emit("plugin-crashed", info.name, info.version);
842+
#endif // BUILDFLAG(ENABLE_PLUIGNS)
840843
}
841844

842845
void WebContents::MediaStartedPlaying(const MediaPlayerInfo& video_type,

patches/common/chromium/.patches

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ allow_new_privileges_in_unsandboxed_child_processes.patch
8686
fix_add_more_checks_in_mojocdmservice.patch
8787
recreate_directmanipulationhelper_when_every_lrwhh_updateparent.patch
8888
notify_directmanipulationeventhandler_when_directmanipulationhelper.patch
89+
build_fix_when_building_with_enable_plugins_false.patch
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: deepak1556 <hop2deep@gmail.com>
3+
Date: Tue, 8 Oct 2019 15:40:50 +0000
4+
Subject: build: fix when building with enable_plugins=false
5+
6+
Bug: none
7+
Change-Id: If878b3a7f5bb051c6e99c617418475c12754ae90
8+
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845624
9+
Reviewed-by: Robert Sesek <rsesek@chromium.org>
10+
Commit-Queue: Robert Sesek <rsesek@chromium.org>
11+
Cr-Commit-Position: refs/heads/master@{#703739}
12+
13+
diff --git a/AUTHORS b/AUTHORS
14+
index 32fc92e6113c6324cc0b09b7a7ff309e2c89ddda..ae51b1d483564c96cb98b603280ac510f90c36c1 100644
15+
--- a/AUTHORS
16+
+++ b/AUTHORS
17+
@@ -219,6 +219,7 @@ Debashish Samantaray <d.samantaray@samsung.com>
18+
Debug Wang <debugwang@tencent.com>
19+
Deepak Dilip Borade <deepak.db@samsung.com>
20+
Deepak Mittal <deepak.m1@samsung.com>
21+
+Deepak Mohan <hop2deep@gmail.com>
22+
Deepak Sharma <deepak.sharma@amd.com>
23+
Deepak Singla <deepak.s@samsung.com>
24+
Deokjin Kim <deokjin81.kim@samsung.com>
25+
diff --git a/content/browser/sandbox_parameters_mac.mm b/content/browser/sandbox_parameters_mac.mm
26+
index b4d539bab49d468e0d2bdade76aad3dba0facfc4..73905a6eac811f9bff04e1b0ceb47b3ea326ee62 100644
27+
--- a/content/browser/sandbox_parameters_mac.mm
28+
+++ b/content/browser/sandbox_parameters_mac.mm
29+
@@ -21,12 +21,16 @@
30+
#include "content/public/browser/plugin_service.h"
31+
#include "content/public/common/content_client.h"
32+
#include "content/public/common/content_switches.h"
33+
-#include "content/public/common/pepper_plugin_info.h"
34+
+#include "ppapi/buildflags/buildflags.h"
35+
#include "sandbox/mac/seatbelt_exec.h"
36+
#include "services/service_manager/sandbox/mac/sandbox_mac.h"
37+
#include "services/service_manager/sandbox/sandbox_type.h"
38+
#include "services/service_manager/sandbox/switches.h"
39+
40+
+#if BUILDFLAG(ENABLE_PLUGINS)
41+
+#include "content/public/common/pepper_plugin_info.h"
42+
+#endif
43+
+
44+
namespace content {
45+
46+
namespace {
47+
@@ -125,6 +129,7 @@ void SetupNetworkSandboxParameters(sandbox::SeatbeltExecClient* client) {
48+
}
49+
}
50+
51+
+#if BUILDFLAG(ENABLE_PLUGINS)
52+
void SetupPPAPISandboxParameters(sandbox::SeatbeltExecClient* client) {
53+
SetupCommonSandboxParameters(client);
54+
55+
@@ -149,6 +154,7 @@ void SetupPPAPISandboxParameters(sandbox::SeatbeltExecClient* client) {
56+
// to n+1 more than the plugins added.
57+
CHECK(index <= 5);
58+
}
59+
+#endif
60+
61+
void SetupCDMSandboxParameters(sandbox::SeatbeltExecClient* client) {
62+
SetupCommonSandboxParameters(client);
63+
@@ -186,9 +192,11 @@ void SetupSandboxParameters(service_manager::SandboxType sandbox_type,
64+
case service_manager::SANDBOX_TYPE_NETWORK:
65+
SetupNetworkSandboxParameters(client);
66+
break;
67+
+#if BUILDFLAG(ENABLE_PLUGINS)
68+
case service_manager::SANDBOX_TYPE_PPAPI:
69+
SetupPPAPISandboxParameters(client);
70+
break;
71+
+#endif
72+
case service_manager::SANDBOX_TYPE_PROFILING:
73+
case service_manager::SANDBOX_TYPE_UTILITY:
74+
SetupUtilitySandboxParameters(client, command_line);

0 commit comments

Comments
 (0)