fix: xdg portal version detection for file dialogs on linux (#46922)

* chore: use dbus thread for portal version detection

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Update shell/browser/ui/file_dialog_linux_portal.cc

Co-authored-by: Robo <hop2deep@gmail.com>

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-05-05 20:59:34 +09:00 committed by GitHub
commit 01994637e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 172 additions and 86 deletions

View file

@ -18,7 +18,6 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/promise.h"
#include "ui/shell_dialogs/select_file_dialog.h"
#include "ui/shell_dialogs/select_file_dialog_linux_portal.h"
#include "ui/shell_dialogs/select_file_policy.h"
#include "ui/shell_dialogs/selected_file_info.h"
@ -60,11 +59,9 @@ ui::SelectFileDialog::FileTypeInfo GetFilterInfo(const Filters& filters) {
}
void LogIfNeededAboutUnsupportedPortalFeature(const DialogSettings& settings) {
if (!settings.default_path.empty() &&
ui::SelectFileDialogLinuxPortal::IsPortalAvailable() &&
ui::SelectFileDialogLinuxPortal::GetPortalVersion() < 4) {
LOG(INFO) << "Available portal version "
<< ui::SelectFileDialogLinuxPortal::GetPortalVersion()
if (!settings.default_path.empty() && IsPortalAvailable() &&
GetPortalVersion() < 4) {
LOG(INFO) << "Available portal version " << GetPortalVersion()
<< " does not support defaultPath option, try the non-portal"
<< " file chooser dialogs by launching with"
<< " --xdg-portal-required-version";