summaryrefslogtreecommitdiff
path: root/www/chromium-uc/patches/patch-chrome_browser_download_download_prefs_cc
diff options
context:
space:
mode:
Diffstat (limited to 'www/chromium-uc/patches/patch-chrome_browser_download_download_prefs_cc')
-rw-r--r--www/chromium-uc/patches/patch-chrome_browser_download_download_prefs_cc100
1 files changed, 0 insertions, 100 deletions
diff --git a/www/chromium-uc/patches/patch-chrome_browser_download_download_prefs_cc b/www/chromium-uc/patches/patch-chrome_browser_download_download_prefs_cc
deleted file mode 100644
index 3385dd7..0000000
--- a/www/chromium-uc/patches/patch-chrome_browser_download_download_prefs_cc
+++ /dev/null
@@ -1,100 +0,0 @@
1$OpenBSD: patch-chrome_browser_download_download_prefs_cc,v 1.32 2021/11/16 11:28:46 robert Exp $
2
3Index: chrome/browser/download/download_prefs.cc
4--- chrome/browser/download/download_prefs.cc.orig
5+++ chrome/browser/download/download_prefs.cc
6@@ -13,6 +13,7 @@
7 #include "base/callback_helpers.h"
8 #include "base/check.h"
9 #include "base/cxx17_backports.h"
10+#include "base/command_line.h"
11 #include "base/feature_list.h"
12 #include "base/files/file_util.h"
13 #include "base/no_destructor.h"
14@@ -60,6 +61,8 @@
15 #include "chrome/browser/ui/pdf/adobe_reader_info_win.h"
16 #endif
17
18+#include "sandbox/policy/switches.h"
19+
20 using content::BrowserContext;
21 using content::BrowserThread;
22 using content::DownloadManager;
23@@ -70,7 +73,7 @@ namespace {
24 // Consider downloads 'dangerous' if they go to the home directory on Linux and
25 // to the desktop on any platform.
26 bool DownloadPathIsDangerous(const base::FilePath& download_path) {
27-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
28+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
29 base::FilePath home_dir = base::GetHomeDir();
30 if (download_path == home_dir) {
31 return true;
32@@ -177,7 +180,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profi
33 #endif // BUILDFLAG(IS_CHROMEOS_ASH)
34
35 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
36- defined(OS_MAC)
37+ defined(OS_MAC) || defined(OS_BSD)
38 should_open_pdf_in_system_reader_ =
39 prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader);
40 #endif
41@@ -296,7 +299,7 @@ void DownloadPrefs::RegisterProfilePrefs(
42 registry->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
43 default_download_path);
44 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
45- defined(OS_MAC)
46+ defined(OS_MAC) || defined(OS_BSD)
47 registry->RegisterBooleanPref(prefs::kOpenPdfDownloadInSystemReader, false);
48 #endif
49 #if defined(OS_ANDROID)
50@@ -430,7 +433,7 @@ bool DownloadPrefs::IsDownloadPathManaged() const {
51
52 bool DownloadPrefs::IsAutoOpenByUserUsed() const {
53 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
54- defined(OS_MAC)
55+ defined(OS_MAC) || defined(OS_BSD)
56 if (ShouldOpenPdfInSystemReader())
57 return true;
58 #endif
59@@ -445,7 +448,7 @@ bool DownloadPrefs::IsAutoOpenEnabled(const GURL& url,
60 DCHECK(extension[0] == base::FilePath::kExtensionSeparator);
61 extension.erase(0, 1);
62 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
63- defined(OS_MAC)
64+ defined(OS_MAC) || defined(OS_BSD)
65 if (base::FilePath::CompareEqualIgnoreCase(extension,
66 FILE_PATH_LITERAL("pdf")) &&
67 ShouldOpenPdfInSystemReader())
68@@ -500,7 +503,7 @@ void DownloadPrefs::DisableAutoOpenByUserBasedOnExtens
69 }
70
71 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
72- defined(OS_MAC)
73+ defined(OS_MAC) || defined(OS_BSD)
74 void DownloadPrefs::SetShouldOpenPdfInSystemReader(bool should_open) {
75 if (should_open_pdf_in_system_reader_ == should_open)
76 return;
77@@ -522,7 +525,7 @@ bool DownloadPrefs::ShouldOpenPdfInSystemReader() cons
78
79 void DownloadPrefs::ResetAutoOpenByUser() {
80 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
81- defined(OS_MAC)
82+ defined(OS_MAC) || defined(OS_BSD)
83 SetShouldOpenPdfInSystemReader(false);
84 #endif
85 auto_open_by_user_.clear();
86@@ -639,9 +642,13 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPa
87 // Fall back to the default download directory for all other paths.
88 return GetDefaultDownloadDirectoryForProfile();
89 #else
90+ // If unveil(2) is used, force the file dialog directory to something we
91+ // know is available.
92+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
93+
94 // If the stored download directory is an absolute path, we presume it's
95 // correct; there's not really much more validation we can do here.
96- if (path.IsAbsolute())
97+ if (command_line->HasSwitch(sandbox::policy::switches::kDisableUnveil) && path.IsAbsolute())
98 return path;
99
100 // When the default download directory is *not* an absolute path, we use the