This directory contains the comprehensive CEF sample application demonstrating advanced browser integration features and CEF capabilities.
cefclient is the primary CEF sample application showcasing:
- Complete feature set - Demonstrates most CEF APIs and integration patterns
- Test framework - Built-in tests for various CEF functionality
- Advanced features - OSR (off-screen rendering), process messaging, scheme handlers, and more
- Multi-window support - Window management, popups, and DevTools
- Cross-platform - Full implementations for Windows, Linux, and macOS
| Feature | cefclient | cefsimple |
|---|---|---|
| Purpose | Comprehensive feature demo & testing | Minimal learning example |
| Complexity | ~100+ source files | ~10 source files |
| Features | Full CEF API coverage | Basic browser only |
| Best for | Reference implementation, testing | Learning CEF basics |
For learning CEF: Start with cefsimple to understand the basics, then explore cefclient for advanced features.
Understanding cefclient architecture:
- CEF Tutorial - Covers cefsimple architecture, which provides the foundation
- CEF General Usage - Complete CEF API documentation
- This application - Explore the built-in tests and advanced implementations
- MainContext (
browser/main_context*) - Application state and CEF initialization - RootWindowManager (
browser/root_window_manager*) - Window creation and management - ClientHandler (
browser/client_handler*) - CEF client implementation with event handlers - RootWindow (
browser/root_window*) - Individual browser window management - TestRunner (
browser/test_runner*) - Test coordination and execution
- browser/ - Browser process implementation (main application logic)
- renderer/ - Renderer process code (runs in isolated renderer processes)
- common/ - Shared code used by multiple processes
- resources/ - HTML/JS/CSS test pages and resources
- mac/, win/ - Platform-specific resources and helpers
- cefclient_gtk.cc - Linux (GTK) entry point
- cefclient_mac.mm - macOS (Cocoa) entry point
- cefclient_win.cc - Windows (Win32) entry point
- Window creation and management
- Navigation and lifecycle
- JavaScript execution
- Resource loading and scheme handlers
- Off-Screen Rendering (OSR) - Windowless rendering with custom painting
- Process messaging - Communication between browser and renderer processes
- DevTools integration - Chrome Developer Tools
- Downloads - Download handling and management
- Dialogs - File dialogs, JavaScript dialogs, context menus
- Performance - DOM access, frame rate control
- Extensions - Chrome extension loading (Chrome style)
The application includes numerous tests accessible via the Tests menu:
- Binding tests (JavaScript ↔ C++ communication)
- Window management tests
- Request/response tests
- JavaScript execution tests
- Scheme handler tests
- And many more...
cefclient supports multiple UI approaches:
- Native - Platform-specific UI (GTK, Cocoa, Win32)
- Views - Cross-platform CEF Views framework
- OSR - Custom rendering without native windows
cefclient uses the Chrome bootstrap and supports two browser styles:
- Chrome style (default) - Modern Chrome browser with advanced features (autofill, extensions, gamepad, etc.) and standard Chrome UI (toolbars, dialogs, etc.)
- Alloy style - Traditional CEF browser based on the Chromium Content API, provides more flexibility for custom UI
Use command-line flags to select the browser style and other options.
Try these different modes to explore various cefclient features:
# Chrome style (default): cefclient # Alloy style: cefclient --use-alloy-style cefclient --use-alloy-style --use-native cefclient --off-screen-rendering-enabled # Multi-threaded message loop (Windows/Linux only): cefclient --multi-threaded-message-loop cefclient --use-alloy-style --multi-threaded-message-loop # Chrome style + native parent (Windows/Linux only): cefclient --use-nativeWhat each mode demonstrates:
- Default - Chrome style with Views framework
- --use-alloy-style - Traditional CEF browser
- --use-native - Platform-specific native UI instead of Views
- --off-screen-rendering-enabled - OSR mode (windowless rendering)
- --multi-threaded-message-loop - Alternative threading model
Note: On macOS, use open cefclient.app --args <flags> to pass command-line arguments.
Once running, explore the Tests menu to see demonstrations of various CEF features.
Unlike cefsimple, cefclient does not have a C API equivalent due to its complexity. For a C API example, see cefsimple_capi.
- CEF Tutorial - Start with cefsimple concepts
- CEF General Usage - Complete API documentation
- cefsimple - Minimal example for learning basics
- CEF Forum - Community support and discussions