fanfeilong/cefutil/cef-integrate
Claude Code and agent skill by fanfeilong/cefutil
- community
Checking that the SKILL.md file is still in the repository.
Integrate an already downloaded CEF binary into an existing native C or C++ application. Use when the host project already exists and must show a browser view, share its message loop, and shut down cleanly. 也用于把 CEF 集成进已有工程、嵌浏览器窗口、接消息循环。
Install
npx vskill@latest install fanfeilong/cefutil/cef-integrateSKILL.md
把 CEF 集成进已有工程
读 docs/05-lifecycle.md、docs/06-application-shape.md 和 docs/09-integrate.md。二进制包已经由 cef-download 选好,并且 cef-build 证明这套工具链能跑起 cefsimple。不要用 archive/ 里的旧工程文件。
接到现有 CMake 或工程
- 确定放置方式再写窗口代码。新窗口用 cefsimple 默认的 Chrome style 和 Views。已有父窗口用
CefWindowInfo::SetAsChild。要把像素送进自己的合成器时用 Alloy style(--use-alloy-style)和SetAsWindowless。官方架构说明里 Chrome style 不支持离屏渲染;以当前包的CefWindowInfo头文件为准。 - 把
libcef_dll作为子目录加入现有工程,或链接cef-build已经产出的libcef_dll_wrapper。包装层和宿主使用同一个编译器、同一个CEF_API_VERSION(若要钉稳定 ABI)。宏的含义见docs/03-binary-boundary.md。 - 链接
libcef。按二进制包 README.txt 把libcef、icudtl.dat、pak、snapshot 和locales/拷到可执行文件旁边。macOS 保持 Framework 与 Helper 的 bundle 相对位置。Linux 设置 rpath 为$ORIGIN。 - 在现有入口里、创建业务窗口之前调用
CefExecuteProcess。这行必须出现在主进程和子进程都会执行到的路径上。返回值大于等于 0 时立刻退出。 - 在
CefInitialize之前把CefSettings.root_cache_path设成该程序专用的绝对路径,再按需要设置它的子目录cache_path和log_file。M120 起,空的root_cache_path会落到平台默认目录,并和其他 CEF 程序抢同一把进程锁。 - 已有 GUI 循环时不要调用
CefRunMessageLoop。保持multi_threaded_message_loop为 false,在主线程周期调用CefDoMessageLoopWork。需要 CEF 独占 UI 时才用CefRunMessageLoop。两种循环不能一起跑。 - 在
OnContextInitialized里CreateBrowser。CefLifeSpanHandler按docs/05-lifecycle.md计数;父窗口第一次系统关闭只调用CloseBrowser(false)并取消关闭。最后一个OnBeforeClose之后停止泵,再CefShutdown。 - 页面要调用原生代码时用
include/wrapper/cef_message_router.h,接线要求见docs/07-javascript.md。不要新增CefRegisterExtension或native function。
开发期按官方 Hands On Tutorial 关闭沙箱,把 sandbox 指针传空。准备发布时再按 docs/10-ship-and-upgrade.md:M138 及更新的 Windows 使用包里的 bootstrap.exe 加载导出 RunWinMain 的 DLL,不要把 cef_sandbox.lib 链进 MSVC 编的 exe。
做完怎么判断
现有程序能打开指定 URL。关闭最后一个浏览器窗口后进程退出。日志不报缺少 pak。渲染进程不是启动后立刻消失。若接了消息路由,页面一次查询能收到原生返回的字符串。
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cef-integrate/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/fanfeilong/cefutil/cef-integrate)