Desktop: Cleaner CEF bidirectional message implementation (#2950)

* Rename CEF implementations to match the process they are called in

* Rename CEF implementations to match the process they are called in

* Implement ipc abstraction

* Call js function `receiveNativeMessage` for all SendToJS ipc messages

* Allow js to call `sendNativeMessage` for sending messages to the browser process

Co-authored-by: Adam <adamgerhant@gmail.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>

* Fix missing safety consideration

---------

Co-authored-by: Adam <adamgerhant@gmail.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
Timon
2025-07-28 13:04:15 +00:00
committed by GitHub
co-authored by Adam Dennis Kobert
parent 7bdf1670b5
commit 83d39fb320
12 changed files with 469 additions and 80 deletions
+5
View File
@@ -8,7 +8,9 @@ mod context;
mod dirs;
mod input;
mod internal;
mod ipc;
mod scheme_handler;
mod utility;
pub(crate) use context::{Context, InitError, Initialized, Setup, SetupError};
use winit::event_loop::EventLoopProxy;
@@ -19,6 +21,7 @@ pub(crate) trait CefEventHandler: Clone {
/// Scheudule the main event loop to run the cef event loop after the timeout
/// [`_cef_browser_process_handler_t::on_schedule_message_pump_work`] for more documentation.
fn schedule_cef_message_loop_work(&self, scheduled_time: Instant);
fn receive_web_message(&self, message: &[u8]);
}
#[derive(Clone, Copy)]
@@ -116,4 +119,6 @@ impl CefEventHandler for CefHandler {
fn schedule_cef_message_loop_work(&self, scheduled_time: std::time::Instant) {
let _ = self.event_loop_proxy.send_event(CustomEvent::ScheduleBrowserWork(scheduled_time));
}
fn receive_web_message(&self, message: &[u8]) {}
}