summaryrefslogtreecommitdiff
path: root/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-pdf-plugin-name.patch
diff options
context:
space:
mode:
Diffstat (limited to 'www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-pdf-plugin-name.patch')
-rw-r--r--www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-pdf-plugin-name.patch389
1 files changed, 0 insertions, 389 deletions
diff --git a/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-pdf-plugin-name.patch b/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-pdf-plugin-name.patch
deleted file mode 100644
index 5b52596..0000000
--- a/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-pdf-plugin-name.patch
+++ /dev/null
@@ -1,389 +0,0 @@
1--- chrome/browser/chrome_content_browser_client.cc.orig
2+++ chrome/browser/chrome_content_browser_client.cc
3@@ -6001,7 +6001,7 @@ bool ChromeContentBrowserClient::ShouldA
4 const url::Origin& embedder_origin,
5 const content::PepperPluginInfo& plugin_info) {
6 #if BUILDFLAG(ENABLE_PDF)
7- if (plugin_info.name == ChromeContentClient::kPDFInternalPluginName) {
8+ if (plugin_info.name == ChromeContentClient::GetPDFInternalPluginName()) {
9 return IsPdfInternalPluginAllowedOrigin(embedder_origin);
10 }
11 #endif // BUILDFLAG(ENABLE_PDF)
12--- chrome/browser/pdf/pdf_extension_util.cc.orig
13+++ chrome/browser/pdf/pdf_extension_util.cc
14@@ -170,7 +170,7 @@ std::string GetManifest() {
15 DCHECK(manifest_contents.find(kNameTag) != std::string::npos);
16 base::ReplaceFirstSubstringAfterOffset(
17 &manifest_contents, 0, kNameTag,
18- ChromeContentClient::kPDFExtensionPluginName);
19+ ChromeContentClient::GetPDFExtensionPluginName());
20
21 return manifest_contents;
22 }
23--- chrome/browser/plugins/pdf_iframe_navigation_throttle_unittest.cc.orig
24+++ chrome/browser/plugins/pdf_iframe_navigation_throttle_unittest.cc
25@@ -65,7 +65,7 @@ class PDFIFrameNavigationThrottleTest :
26 // Register a fake PDF Viewer plugin into our plugin service.
27 content::WebPluginInfo info;
28 info.name =
29- base::ASCIIToUTF16(ChromeContentClient::kPDFExtensionPluginName);
30+ base::ASCIIToUTF16(ChromeContentClient::GetPDFExtensionPluginName());
31 info.mime_types.push_back(content::WebPluginMimeType(
32 kPDFMimeType, "pdf", "Fake PDF description"));
33 plugin_service->RegisterInternalPlugin(info, true);
34--- chrome/browser/plugins/plugin_prefs.cc.orig
35+++ chrome/browser/plugins/plugin_prefs.cc
36@@ -40,7 +40,7 @@ bool IsPDFViewerPlugin(const std::u16str
37 // plugin, which is also used for Print Preview. Note that only the PDF viewer
38 // and Print Preview can create the internal PDF plugin in the first place.
39 return plugin_name ==
40- base::ASCIIToUTF16(ChromeContentClient::kPDFExtensionPluginName);
41+ base::ASCIIToUTF16(ChromeContentClient::GetPDFExtensionPluginName());
42 }
43
44 } // namespace
45--- chrome/browser/plugins/plugin_prefs_unittest.cc.orig
46+++ chrome/browser/plugins/plugin_prefs_unittest.cc
47@@ -24,11 +24,11 @@ class PluginPrefsTest : public ::testing
48 TEST_F(PluginPrefsTest, AlwaysOpenPdfExternally) {
49 EXPECT_EQ(PluginPrefs::NO_POLICY,
50 plugin_prefs_->PolicyStatusForPlugin(base::ASCIIToUTF16(
51- ChromeContentClient::kPDFExtensionPluginName)));
52+ ChromeContentClient::GetPDFExtensionPluginName())));
53
54 SetAlwaysOpenPdfExternally(true);
55
56 EXPECT_EQ(PluginPrefs::POLICY_DISABLED,
57 plugin_prefs_->PolicyStatusForPlugin(base::ASCIIToUTF16(
58- ChromeContentClient::kPDFExtensionPluginName)));
59+ ChromeContentClient::GetPDFExtensionPluginName())));
60 }
61--- chrome/browser/resources/plugin_metadata/plugins_chromeos.json.orig
62+++ chrome/browser/resources/plugin_metadata/plugins_chromeos.json
63@@ -44,6 +44,19 @@
64 "name": "Chrome PDF Viewer",
65 "group_name_matcher": "*Chrome PDF Viewer*"
66 },
67+ "microsoft-edge-pdf": {
68+ "mime_types": [
69+ ],
70+ "versions": [
71+ {
72+ "version": "0",
73+ "status": "fully_trusted",
74+ "comment": "Microsoft Edge PDF has no version information."
75+ }
76+ ],
77+ "name": "Microsoft Edge PDF Viewer",
78+ "group_name_matcher": "*Microsoft Edge PDF Viewer*"
79+ },
80 "chromium-pdf": {
81 "mime_types": [
82 ],
83@@ -70,6 +83,19 @@
84 "name": "Chrome PDF Plugin",
85 "group_name_matcher": "*Chrome PDF Plugin*"
86 },
87+ "microsoft-edge-pdf-plugin": {
88+ "mime_types": [
89+ ],
90+ "versions": [
91+ {
92+ "version": "0",
93+ "status": "fully_trusted",
94+ "comment": "Microsoft Edge PDF Plugin has no version information."
95+ }
96+ ],
97+ "name": "Microsoft Edge PDF Plugin",
98+ "group_name_matcher": "*Microsoft Edge PDF Plugin*"
99+ },
100 "chromium-pdf-plugin": {
101 "mime_types": [
102 ],
103--- chrome/browser/resources/plugin_metadata/plugins_linux.json.orig
104+++ chrome/browser/resources/plugin_metadata/plugins_linux.json
105@@ -36,6 +36,19 @@
106 "name": "Chrome PDF Viewer",
107 "group_name_matcher": "*Chrome PDF Viewer*"
108 },
109+ "microsoft-edge-pdf": {
110+ "mime_types": [
111+ ],
112+ "versions": [
113+ {
114+ "version": "0",
115+ "status": "fully_trusted",
116+ "comment": "Microsoft Edge PDF has no version information."
117+ }
118+ ],
119+ "name": "Microsoft Edge PDF Viewer",
120+ "group_name_matcher": "*Microsoft Edge PDF Viewer*"
121+ },
122 "chromium-pdf": {
123 "mime_types": [
124 ],
125@@ -62,6 +75,19 @@
126 "name": "Chrome PDF Plugin",
127 "group_name_matcher": "*Chrome PDF Plugin*"
128 },
129+ "microsoft-edge-pdf-plugin": {
130+ "mime_types": [
131+ ],
132+ "versions": [
133+ {
134+ "version": "0",
135+ "status": "fully_trusted",
136+ "comment": "Google Chrome PDF Plugin has no version information."
137+ }
138+ ],
139+ "name": "Microsoft Edge PDF Plugin",
140+ "group_name_matcher": "*Microsoft Edge PDF Plugin*"
141+ },
142 "chromium-pdf-plugin": {
143 "mime_types": [
144 ],
145--- chrome/browser/resources/plugin_metadata/plugins_mac.json.orig
146+++ chrome/browser/resources/plugin_metadata/plugins_mac.json
147@@ -33,6 +33,19 @@
148 "name": "Chrome PDF Viewer",
149 "group_name_matcher": "*Chrome PDF Viewer*"
150 },
151+ "microsoft-edge-pdf": {
152+ "mime_types": [
153+ ],
154+ "versions": [
155+ {
156+ "version": "0",
157+ "status": "fully_trusted",
158+ "comment": "Microsoft Edge PDF Viewer has no version information."
159+ }
160+ ],
161+ "name": "Microsoft Edge PDF Viewer",
162+ "group_name_matcher": "*Microsoft Edge PDF Viewer*"
163+ },
164 "chromium-pdf": {
165 "mime_types": [
166 ],
167@@ -59,6 +72,19 @@
168 "name": "Chrome PDF Plugin",
169 "group_name_matcher": "*Chrome PDF Plugin*"
170 },
171+ "microsoft-edge-pdf-plugin": {
172+ "mime_types": [
173+ ],
174+ "versions": [
175+ {
176+ "version": "0",
177+ "status": "fully_trusted",
178+ "comment": "Microsoft Edge PDF Plugin has no version information."
179+ }
180+ ],
181+ "name": "Microsoft Edge PDF Plugin",
182+ "group_name_matcher": "*Microsoft Edge PDF Plugin*"
183+ },
184 "chromium-pdf-plugin": {
185 "mime_types": [
186 ],
187--- chrome/browser/resources/plugin_metadata/plugins_win.json.orig
188+++ chrome/browser/resources/plugin_metadata/plugins_win.json
189@@ -33,6 +33,19 @@
190 "name": "Chrome PDF Viewer",
191 "group_name_matcher": "*Chrome PDF Viewer*"
192 },
193+ "microsoft-edge-pdf": {
194+ "mime_types": [
195+ ],
196+ "versions": [
197+ {
198+ "version": "0",
199+ "status": "fully_trusted",
200+ "comment": "Microsoft Edge PDF Viewer has no version information."
201+ }
202+ ],
203+ "name": "Microsoft Edge PDF Viewer",
204+ "group_name_matcher": "*Microsoft Edge PDF Viewer*"
205+ },
206 "chromium-pdf": {
207 "mime_types": [
208 ],
209@@ -59,6 +72,19 @@
210 "name": "Chrome PDF Plugin",
211 "group_name_matcher": "*Chrome PDF Plugin*"
212 },
213+ "microsoft-edge-pdf-plugin": {
214+ "mime_types": [
215+ ],
216+ "versions": [
217+ {
218+ "version": "0",
219+ "status": "fully_trusted",
220+ "comment": "Microsoft Edge PDF Plugin has no version information."
221+ }
222+ ],
223+ "name": "Microsoft Edge PDF Plugin",
224+ "group_name_matcher": "*Microsoft Edge PDF Plugin*"
225+ },
226 "chromium-pdf-plugin": {
227 "mime_types": [
228 ],
229--- chrome/browser/ungoogled_flag_choices.h.orig
230+++ chrome/browser/ungoogled_flag_choices.h
231@@ -34,4 +34,9 @@ const FeatureEntry::Choice kScrollEventC
232 "scroll-tabs",
233 "never"}
234 };
235+const FeatureEntry::Choice kPDFPluginNameChoices[] = {
236+ {"Chromium", "", ""},
237+ {"Google Chrome", switches::kPDFPluginName, "chrome"},
238+ {"Microsoft Edge", switches::kPDFPluginName, "edge"},
239+};
240 #endif // CHROME_BROWSER_UNGOOGLED_FLAG_CHOICES_H_
241--- chrome/browser/ungoogled_flag_entries.h.orig
242+++ chrome/browser/ungoogled_flag_entries.h
243@@ -40,4 +40,8 @@
244 "Scroll switches tab",
245 "Switch to the left/right tab if the wheel-scroll happens over the tabstrip, or the empty space beside the tabstrip. ungoogled-chromium flag.",
246 kOsDesktop, MULTI_VALUE_TYPE(kScrollEventChangesTab)},
247+ {"pdf-plugin-name",
248+ "Set internal PDF plugin name",
249+ "Sets the internal PDF viewer plugin name. Useful for sites that probe JS API navigator.plugins. ungoogled-chromium flag.",
250+ kOsDesktop, MULTI_VALUE_TYPE(kPDFPluginNameChoices)},
251 #endif // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_
252--- chrome/common/BUILD.gn.orig
253+++ chrome/common/BUILD.gn
254@@ -249,6 +249,7 @@ static_library("common") {
255 "//components/no_state_prefetch/common",
256 "//components/no_state_prefetch/common:mojo_bindings",
257 "//components/page_load_metrics/common:common",
258+ "//components/ungoogled:ungoogled_switches",
259 ]
260
261 if (enable_pdf) {
262--- chrome/common/chrome_content_client.cc.orig
263+++ chrome/common/chrome_content_client.cc
264@@ -122,7 +122,7 @@ void ComputeBuiltInPlugins(std::vector<c
265 content::PepperPluginInfo pdf_info;
266 pdf_info.is_internal = true;
267 pdf_info.is_out_of_process = true;
268- pdf_info.name = ChromeContentClient::kPDFInternalPluginName;
269+ pdf_info.name = ChromeContentClient::GetPDFInternalPluginName();
270 pdf_info.description = kPDFPluginDescription;
271 pdf_info.path = base::FilePath(ChromeContentClient::kPDFPluginPath);
272 content::WebPluginMimeType pdf_mime_type(
273--- chrome/common/chrome_content_client.h.orig
274+++ chrome/common/chrome_content_client.h
275@@ -42,8 +42,8 @@ class ChromeContentClient : public conte
276 static const base::FilePath::CharType kNaClPluginFileName[];
277 #endif
278
279- static const char kPDFExtensionPluginName[];
280- static const char kPDFInternalPluginName[];
281+ static const char *GetPDFExtensionPluginName();
282+ static const char *GetPDFInternalPluginName();
283 static const base::FilePath::CharType kPDFPluginPath[];
284
285 ChromeContentClient();
286--- chrome/common/chrome_content_client_constants.cc.orig
287+++ chrome/common/chrome_content_client_constants.cc
288@@ -2,8 +2,12 @@
289 // Use of this source code is governed by a BSD-style license that can be
290 // found in the LICENSE file.
291
292+#include <string>
293+
294+#include "base/command_line.h"
295 #include "build/branding_buildflags.h"
296 #include "chrome/common/chrome_content_client.h"
297+#include "components/ungoogled/ungoogled_switches.h"
298
299 #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
300 const base::FilePath::CharType ChromeContentClient::kNotPresent[] =
301@@ -15,15 +19,52 @@ const base::FilePath::CharType ChromeCon
302 FILE_PATH_LITERAL("internal-nacl-plugin");
303 #endif
304
305-#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
306-const char ChromeContentClient::kPDFExtensionPluginName[] = "Chrome PDF Viewer";
307-const char ChromeContentClient::kPDFInternalPluginName[] = "Chrome PDF Plugin";
308-#else
309-const char ChromeContentClient::kPDFExtensionPluginName[] =
310+namespace {
311+
312+const char kChromePDFExtensionPluginName[] =
313+ "Chrome PDF Viewer";
314+const char kChromePDFInternalPluginName[] =
315+ "Chrome PDF Plugin";
316+const char kEdgePDFExtensionPluginName[] =
317+ "Microsoft Edge PDF Viewer";
318+const char kEdgePDFInternalPluginName[] =
319+ "Microsoft Edge PDF Plugin";
320+const char kChromiumPDFExtensionPluginName[] =
321 "Chromium PDF Viewer";
322-const char ChromeContentClient::kPDFInternalPluginName[] =
323+const char kChromiumPDFInternalPluginName[] =
324 "Chromium PDF Plugin";
325-#endif
326+
327+} // namespace
328+
329+// static
330+const char *ChromeContentClient::GetPDFExtensionPluginName() {
331+ const base::CommandLine& command_line =
332+ *base::CommandLine::ForCurrentProcess();
333+ if (command_line.HasSwitch(switches::kPDFPluginName)) {
334+ std::string switch_value = command_line.GetSwitchValueASCII(switches::kPDFPluginName);
335+ if (switch_value == "edge") {
336+ return kEdgePDFExtensionPluginName;
337+ } else if (switch_value == "chrome") {
338+ return kChromePDFExtensionPluginName;
339+ }
340+ }
341+ return kChromiumPDFExtensionPluginName;
342+}
343+
344+// static
345+const char *ChromeContentClient::GetPDFInternalPluginName() {
346+ const base::CommandLine& command_line =
347+ *base::CommandLine::ForCurrentProcess();
348+ if (command_line.HasSwitch(switches::kPDFPluginName)) {
349+ std::string switch_value = command_line.GetSwitchValueASCII(switches::kPDFPluginName);
350+ if (switch_value == "edge") {
351+ return kEdgePDFInternalPluginName;
352+ } else if (switch_value == "chrome") {
353+ return kChromePDFInternalPluginName;
354+ }
355+ }
356+ return kChromiumPDFInternalPluginName;
357+}
358
359 const base::FilePath::CharType ChromeContentClient::kPDFPluginPath[] =
360 FILE_PATH_LITERAL("internal-pdf-viewer");
361--- chrome/renderer/chrome_content_renderer_client.cc.orig
362+++ chrome/renderer/chrome_content_renderer_client.cc
363@@ -1047,7 +1047,7 @@ WebPlugin* ChromeContentRendererClient::
364 }
365 }
366 } else if (info.name ==
367- ASCIIToUTF16(ChromeContentClient::kPDFExtensionPluginName)) {
368+ ASCIIToUTF16(ChromeContentClient::GetPDFExtensionPluginName())) {
369 // Report PDF load metrics. Since the PDF plugin is comprised of an
370 // extension that loads a second plugin, avoid double counting by
371 // ignoring the creation of the second plugin.
372@@ -1079,7 +1079,7 @@ WebPlugin* ChromeContentRendererClient::
373
374 #if BUILDFLAG(ENABLE_PDF)
375 if (info.name ==
376- ASCIIToUTF16(ChromeContentClient::kPDFInternalPluginName)) {
377+ ASCIIToUTF16(ChromeContentClient::GetPDFInternalPluginName())) {
378 return pdf::CreateInternalPlugin(
379 info, std::move(params), render_frame,
380 std::make_unique<ChromePdfInternalPluginDelegate>());
381@@ -1092,7 +1092,7 @@ WebPlugin* ChromeContentRendererClient::
382 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type,
383 url);
384 if (info.name ==
385- ASCIIToUTF16(ChromeContentClient::kPDFExtensionPluginName)) {
386+ ASCIIToUTF16(ChromeContentClient::GetPDFExtensionPluginName())) {
387 ReportPDFLoadStatus(
388 PDFLoadStatus::kShowedDisabledPluginPlaceholderForEmbeddedPdf);
389