aboutsummaryrefslogblamecommitdiff
path: root/www/ungoogled-chromium/files/patch-chrome_browser_profiles_profile__impl.cc
blob: cc9182cf5d3ec5f8f5953e8e3885752dfb03a3d2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
                                                                               
                                           
                    









                                                            
                                                                           
















                                                                            
--- chrome/browser/profiles/profile_impl.cc.orig	2022-12-02 17:56:32 UTC
+++ chrome/browser/profiles/profile_impl.cc
@@ -256,6 +256,10 @@
 #include "chrome/browser/spellchecker/spellcheck_service.h"
 #endif
 
+#if BUILDFLAG(IS_OPENBSD)
+#include "sandbox/policy/openbsd/sandbox_openbsd.h"
+#endif
+
 using bookmarks::BookmarkModel;
 using content::BrowserThread;
 using content::DownloadManagerDelegate;
@@ -826,7 +830,17 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) 
 }
 
 base::FilePath ProfileImpl::last_selected_directory() {
+#if BUILDFLAG(IS_OPENBSD)
+  // If unveil(2) is used, force the file dialog directory to something we
+  // know is available.
+  auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
+  if (sandbox->unveil_initialized())
+    return GetPrefs()->GetFilePath(prefs::kDownloadDefaultDirectory);
+  else
+    return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
+#else
   return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
+#endif
 }
 
 void ProfileImpl::set_last_selected_directory(const base::FilePath& path) {