mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
Browser+LibWeb+WebContent: Allow Browser to load local files
To achieve this goal: - The Browser unveils "/tmp/portal/filesystemaccess" - Pass the page through LoadRequest => ResourceLoader - ResourceLoader requests a file to the FileSystemAccessServer via IPC - OutOfProcessWebView handles it and sends a file descriptor back to the Page.
This commit is contained in:
parent
1ba9c821fb
commit
662711fa26
21 changed files with 165 additions and 14 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "OutOfProcessWebView.h"
|
||||
#include "WebContentClient.h"
|
||||
#include <AK/String.h>
|
||||
#include <LibFileSystemAccessClient/Client.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Desktop.h>
|
||||
#include <LibGUI/InputBox.h>
|
||||
|
@ -400,6 +401,15 @@ void OutOfProcessWebView::notify_server_did_update_resource_count(i32 count_wait
|
|||
on_resource_status_change(count_waiting);
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32 request_id)
|
||||
{
|
||||
auto file = FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window(), path);
|
||||
if (file.is_error())
|
||||
client().async_handle_file_return(file.error().code(), {}, request_id);
|
||||
else
|
||||
client().async_handle_file_return(0, IPC::File(file.value()->leak_fd()), request_id);
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::did_scroll()
|
||||
{
|
||||
client().async_set_viewport_rect(visible_content_rect());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue