1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Headless Chromium CDP backend for buffr-engine.
//!
//! `buffr-blink-cdp` implements the [`buffr_engine::BrowserEngine`] trait by
//! driving a headless Chromium process over the Chrome DevTools Protocol
//! (CDP). It serves as the second concrete backend that validates the engine
//! abstraction and enables running buffr without the CEF SDK installed.
//!
//! # Position in the workspace
//!
//! ```text
//! apps/buffr ──► buffr-engine (trait)
//! ▲
//! buffr-blink-cdp (this crate — CDP backend)
//! ```
//!
//! No CEF headers or libraries are needed. A Chromium or Google Chrome
//! binary must be present on `PATH` at runtime (see System requirement below).
//!
//! # System requirement
//!
//! A Chromium or Google Chrome binary must be installed and reachable via
//! `PATH`. Checked candidates (in order):
//!
//! - Linux: `chromium-browser`, `chromium`, `google-chrome`, `google-chrome-stable`
//! - macOS: `/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`,
//! then the same PATH candidates
//!
//! The binary is **not** bundled — no Chromium binaries are downloaded or
//! embedded. If none is found, [`engine::BlinkCdpEngine::new`] returns
//! [`error::BlinkError::ChromiumNotFound`].
//!
//! # Implements
//!
//! [`BrowserEngine`](buffr_engine::BrowserEngine) methods fully covered:
//! - Tab lifecycle: `open_tab`, `close_tab`, `activate_tab`
//! - Navigation: `navigate`, `go_back`, `go_forward`, `reload`, `stop`
//! - OSR: `osr_resize` + `Page.startScreencast` push (ack-throttled)
//! - Input: `send_key_event`, `send_mouse_event`, `send_scroll_event`
//!
//! Deferred (return [`buffr_engine::EngineError::Unimplemented`]):
//! `duplicate_active`, `reopen_closed_tab`, clipboard ops, edit ops,
//! context menu handling, find-in-page, downloads, audio, dev tools,
//! custom schemes, and OSR sleep.
//!
//! # Phases
//!
//! The v0.9.0 capability surface targets:
//! - Permissions: `Page.handleJavaScriptDialog` + `Browser.grantPermissions`
//! - Downloads: `Page.downloadWillBegin` + `Page.downloadProgress` CDP events
//! - Find-in-page: `Page.find` + `Page.findNextResult`
//! - Context menu: `Page.contextMenuShown` CDP event + build model bridge
//! - IME: `Input.imeSetComposition` + `Input.insertText`
//! - Custom schemes: `fetch` intercept via `Network.requestIntercepted`
//! - Picture-in-Picture: JS `video.requestPictureInPicture()` via
//! `Runtime.evaluate`
pub use BlinkCdpBackend;
pub use BlinkCdpEngine;
pub use BlinkError;