#include <cstddef>
#include <memory>
#include <set>
#include <string_view>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/nix/mime_util_xdg.h"
#include "base/nix/xdg_util.h"
#include "base/process/launch.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread_restrictions.h"
#include "base/version.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/shell_dialogs/select_file_dialog_linux.h"
#include "ui/shell_dialogs/selected_file_info.h"
#include "ui/strings/grit/ui_strings.h"
#include "url/gurl.h"
namespace {
std::string GetTitle(const std::string& title, int message_id) { … }
const char kKdialogBinary[] = …;
}
namespace ui {
class SelectFileDialogLinuxKde : public SelectFileDialogLinux { … };
bool SelectFileDialogLinux::CheckKDEDialogWorksOnUIThread(
std::string& kdialog_version) { … }
SelectFileDialog* NewSelectFileDialogLinuxKde(
SelectFileDialog::Listener* listener,
std::unique_ptr<ui::SelectFilePolicy> policy,
base::nix::DesktopEnvironment desktop,
const std::string& kdialog_version) { … }
SelectFileDialogLinuxKde::SelectFileDialogLinuxKde(
Listener* listener,
std::unique_ptr<ui::SelectFilePolicy> policy,
base::nix::DesktopEnvironment desktop,
const std::string& kdialog_version)
: … { … }
SelectFileDialogLinuxKde::~SelectFileDialogLinuxKde() = default;
bool SelectFileDialogLinuxKde::IsRunning(
gfx::NativeWindow parent_window) const { … }
void SelectFileDialogLinuxKde::SelectFileImpl(
Type type,
const std::u16string& title,
const base::FilePath& default_path,
const FileTypeInfo* file_types,
int file_type_index,
const base::FilePath::StringType& default_extension,
gfx::NativeWindow owning_window,
const GURL* caller) { … }
bool SelectFileDialogLinuxKde::HasMultipleFileTypeChoicesImpl() { … }
std::string SelectFileDialogLinuxKde::GetMimeTypeFilterString() { … }
std::unique_ptr<SelectFileDialogLinuxKde::KDialogOutputParams>
SelectFileDialogLinuxKde::CallKDialogOutput(const KDialogParams& params) { … }
void SelectFileDialogLinuxKde::GetKDialogCommandLine(
const std::string& type,
const std::string& title,
const base::FilePath& path,
gfx::AcceleratedWidget parent,
bool file_operation,
bool multiple_selection,
base::CommandLine* command_line) { … }
void SelectFileDialogLinuxKde::FileSelected(const base::FilePath& path) { … }
void SelectFileDialogLinuxKde::MultiFilesSelected(
const std::vector<base::FilePath>& files) { … }
void SelectFileDialogLinuxKde::FileNotSelected() { … }
void SelectFileDialogLinuxKde::CreateSelectFolderDialog(
Type type,
const std::string& title,
const base::FilePath& default_path,
gfx::AcceleratedWidget parent) { … }
void SelectFileDialogLinuxKde::CreateFileOpenDialog(
const std::string& title,
const base::FilePath& default_path,
gfx::AcceleratedWidget parent) { … }
void SelectFileDialogLinuxKde::CreateMultiFileOpenDialog(
const std::string& title,
const base::FilePath& default_path,
gfx::AcceleratedWidget parent) { … }
void SelectFileDialogLinuxKde::CreateSaveAsDialog(
const std::string& title,
const base::FilePath& default_path,
gfx::AcceleratedWidget parent) { … }
void SelectFileDialogLinuxKde::SelectSingleFileHelper(
bool allow_folder,
std::unique_ptr<KDialogOutputParams> results) { … }
void SelectFileDialogLinuxKde::OnSelectSingleFileDialogResponse(
gfx::AcceleratedWidget parent,
std::unique_ptr<KDialogOutputParams> results) { … }
void SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse(
gfx::AcceleratedWidget parent,
std::unique_ptr<KDialogOutputParams> results) { … }
void SelectFileDialogLinuxKde::OnSelectMultiFileDialogResponse(
gfx::AcceleratedWidget parent,
std::unique_ptr<KDialogOutputParams> results) { … }
}