Repository: electron
Issue: [Feature Request]: Support FileTransfer portal (secure drag and drop between sandboxed Linux apps)
Labels: enhancement :sparkles:,platform/linux

### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Problem Description

Electron should support the FileTransfer portal as it will let users drag & drop and copy-paste files/folders securely to sandboxed Linux apps.

Flatpak and other sandboxed Linux packages (eg. Snap) use [XDG Desktop Portal](https://github.com/flatpak/xdg-desktop-portal) to securely communicate between the sandbox and the host. This is crucial for sandboxed apps, as otherwise apps need to be given unilateral access to the host, notably file system access.

XDG Desktop Portal's [FileChooser portal](https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.impl.portal.FileChooser) was recently implemented in Electron: https://github.com/electron/electron/pull/19159. This means a sandboxed app could have no unilateral file system access, but still open the file picker, select, and "upload" a file/folder to an app without letting that sandboxed app know about anything other than the picked file/folder.

However, the FileChooser portal does not cover dragging & dropping a file into an Electron app (or vice versa) or secure copy-paste. The [FileTransfer portal](https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.portal.FileTransfer) is what is needed for drag & drop and copy-paste to work securely between the host and the sandbox.

### Proposed Solution

Implement support for the FileTranfer portal in Electron. This might be best done in Chromium and then reused in Electron. The libportal library could eventually be used here but [it does not yet support FileTransfer](https://github.com/flatpak/libportal/issues/13).

The FileTranfer portal can be used by both sandboxed and non sandboxed apps, as discussed here: https://github.com/flatpak/libportal/issues/33

### Alternatives Considered

Workaround by giving sandboxed apps unilateral permission to access the host's filesystem. This is the status quo today for many apps, and is very much an anti-goal for sandboxed apps.

### Additional Information

For this implementation to be useful, other apps are also required to support the FileTransfer portal. So if a user drags a file from a file manager to an Electron app (with FileTransfer implemented), that file manager must support FileTransfer too, otherwise it will still not work.

As of 2021-08-19, the only other toolkit/framework that supports the FileTransfer portal is GTK4.

Bugs for other toolkits/frameworks:
[GTK 3](https://gitlab.gnome.org/GNOME/gtk/-/issues/3094), [QT](https://bugreports.qt.io/browse/QTBUG-91357)