mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:42:44 +00:00 
			
		
		
		
	Ladybird+LibWebView: Migrate file APIs to LibWebView callbacks
This also sets the default callback to do what every non-Serenity browser is doing, rather than copy-pasting this callback into every implementation. The callback is still available for any platform which might want to override the default behavior. For example, OOPWV now overrides this callback to use FileSystemAccessClient.
This commit is contained in:
		
							parent
							
								
									ebdcba8b3b
								
							
						
					
					
						commit
						15da77f4c4
					
				
					 10 changed files with 21 additions and 44 deletions
				
			
		|  | @ -28,6 +28,15 @@ OutOfProcessWebView::OutOfProcessWebView() | |||
|     set_focus_policy(GUI::FocusPolicy::StrongFocus); | ||||
| 
 | ||||
|     create_client(); | ||||
| 
 | ||||
|     on_request_file = [this](auto const& path, auto request_id) { | ||||
|         auto file = FileSystemAccessClient::Client::the().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().stream()), request_id); | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| OutOfProcessWebView::~OutOfProcessWebView() = default; | ||||
|  | @ -231,15 +240,6 @@ void OutOfProcessWebView::notify_server_did_leave_tooltip_area(Badge<WebContentC | |||
|     GUI::Application::the()->hide_tooltip(); | ||||
| } | ||||
| 
 | ||||
| void OutOfProcessWebView::notify_server_did_request_file(Badge<WebContentClient>, DeprecatedString const& path, i32 request_id) | ||||
| { | ||||
|     auto file = FileSystemAccessClient::Client::the().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().stream()), 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
	
	 Timothy Flynn
						Timothy Flynn