Add CefDragData::GetFilePaths to return file paths (fixes #3568)

GetFileNames now returns just the display names with a fallback to
path.BaseName() if the display name is empty.
This commit is contained in:
Cristian Amarie
2023-09-22 14:04:16 +03:00
committed by Marshall Greenblatt
parent 4ae030fec1
commit bdec92caf8
8 changed files with 105 additions and 9 deletions

View File

@ -126,7 +126,7 @@ bool CefDragDataImpl::GetFileNames(std::vector<CefString>& names) {
for (; it != data_.filenames.end(); ++it) {
auto name = it->display_name.value();
if (name.empty()) {
name = it->path.value();
name = it->path.BaseName().value();
}
names.push_back(name);
}
@ -134,6 +134,21 @@ bool CefDragDataImpl::GetFileNames(std::vector<CefString>& names) {
return true;
}
bool CefDragDataImpl::GetFilePaths(std::vector<CefString>& paths) {
base::AutoLock lock_scope(lock_);
if (data_.filenames.empty()) {
return false;
}
std::vector<ui::FileInfo>::const_iterator it = data_.filenames.begin();
for (; it != data_.filenames.end(); ++it) {
auto path = it->path.value();
paths.push_back(path);
}
return true;
}
void CefDragDataImpl::SetLinkURL(const CefString& url) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();