Skip to content

feat: expose client delegate hooks required by embedding hosts - #44

Merged
tishion merged 6 commits into
mainfrom
feat/unity-callbacks
Sep 22, 2026
Merged

tishion merged 6 commits into
mainfrom
feat/unity-callbacks

Conversation

@xy00099

@xy00099 xy00099 commented Sep 20, 2026

Copy link
Copy Markdown
Member

Summary

Adds four virtual hooks to CefViewBrowserClientDelegate that embedding hosts currently have no way to observe. All have default implementations and are purely additive — no existing override changes behavior.

Hook Before After
onBeforeBrowse dropped after message_router_->OnBeforeBrowse forwarded; return true cancels
onRenderProcessTerminated dropped after message-router cleanup forwarded with status/error_code/error_string (CEF 124+; two-arg overload otherwise)
onFindResult result discarded entirely (empty OnFindResult body) forwarded with identifier/count/selectionRect/activeMatchOrdinal/finalUpdate
onFileDialogEx — (CEF 126+ accept extensions/descriptions unavailable) new; default falls back to onFileDialog, existing subclasses unaffected

Why these four

  • onBeforeBrowse: the only interception point for in-page navigations, redirects, iframes and window.open — hosts cannot implement a navigation policy without it.
  • onRenderProcessTerminated: renderer-crash observability (host auto-reload / telemetry).
  • onFindResult: powers find-in-page UI; the current implementation receives the callback and drops it.
  • onFileDialogEx: exposes the accept extensions/descriptions CEF 126+ provides; the legacy onFileDialog cannot carry them.

Compatibility

  • Default implementations only: overriding none of them is the previous behavior.
  • onFileDialogEx guards CEF_VERSION_MAJOR >= 126; onRenderProcessTerminated keeps a two-arg path for CEF < 124.
  • No ABI change to existing symbols. Note: commit 0bba10b (CefVersion.h pin) is fork-local (127.3.5 rollback baseline) — exclude it from the merge or I can rebase it out.

Validation

Downstream consumer (Unity embedding) runs these hooks through a pfn callback ABI with machine-verified regressions: navigation-policy rejections observable end-to-end (javascript: blocked with machine-readable reasons), renderer kill injection → termination + auto-reload, find results streamed to host UI, file dialog extensions/descriptions crossing the ABI as JSON.

🤖 Generated with Claude Code

@tishion
tishion enabled auto-merge (rebase) September 22, 2026 00:10
xy00010 and others added 6 commits September 22, 2026 08:15
The browser-side find result is currently discarded before the embedder
can observe match count or final-update state. Add a default no-op
onFindResult to the delegate and forward from the find handler.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Embedders can only filter explicit host-side navigation today;
in-page navigations, redirects and iframes bypass the policy
entirely, and renderer crashes are invisible: only the message
router and the implicit URL reload observe them. Add default
no-op hooks on the delegate and forward from the request handler,
preserving the existing reload behavior.

Co-Authored-By: Claude Code <noreply@anthropic.com>
CEF 126+ provides accept_extensions and accept_descriptions but the
delegate only receives display filters, so embedders cannot rebuild
native file dialogs. Add onFileDialogEx with the extra information;
the default implementation falls back to onFileDialog so existing
delegates keep working.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The bare name does not resolve at the delegate header level; with the
142 SDK the 4-argument declaration fails to parse (C2061) and the
request handler call site no longer matches.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The 142.0.15 headers were rolled back on this machine per the preset
criteria (OSR renderer alive but no paint callback ever arrives; see
DependencyBaseline notes). The local clone's checkout drifts to 142
when repointed at upstream main; committing the 127.3.5 pin keeps the
working tree consistent with the deployed/validated baseline.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
@tishion
tishion force-pushed the feat/unity-callbacks branch from 971fb9d to 79a4736 Compare September 22, 2026 00:15
@tishion
tishion self-requested a review September 22, 2026 00:23
@tishion
tishion merged commit b4751a2 into main Sep 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants