Skip to content

CefBrowserView

Header: cef_browser_view.h
Category: Views Framework

Overview

Browser-process UI toolkit: windows, panels, layouts, buttons, textfields, and their delegates.

CefBrowserView

Source File: include/views/cef_browser_view.h

Process / Thread Context: Browser Process / UI Thread.

Purpose: A view that hosts a CefBrowser instance. This is the integration

Methods

static CefRefPtr<CefBrowserView> CreateBrowserView(CefRefPtr<CefClient> client, const CefString& url, const CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue> extra_info, CefRefPtr<CefRequestContext> request_context, CefRefPtr<CefBrowserViewDelegate> delegate)

Parameters:

  • client: The CefClient instance that handles browser events (may be
  • url: The initial URL to load.
  • settings: Browser-level settings.
  • extra_info: Optional dictionary passed to
  • request_context: Optional request context for cache/cookie isolation.
  • delegate: Optional CefBrowserViewDelegate.

Return Value: A new CefBrowserView. The underlying CefBrowser is

Usage Instruction: Primary factory for embedding web content inside a

Threading Constraint: Browser process UI thread.

static CefRefPtr<CefBrowserView> GetForBrowser(CefRefPtr<CefBrowser> browser)

Parameters:

  • browser: A CefBrowser instance.

Return Value: The CefBrowserView hosting browser, or NULL.

Usage Instruction: Bridge from a CefBrowser pointer (e.g. received in

Threading Constraint: Browser process UI thread.

virtual CefRefPtr<CefBrowser> GetBrowser() = 0

Parameters:

  • none.

Return Value: The CefBrowser hosted by this view, or NULL if not yet

Usage Instruction: Interact with the web content (load URLs, execute

Threading Constraint: Browser process UI thread.

virtual CefRefPtr<CefView> GetChromeToolbar() = 0

Parameters:

  • none.

Return Value: The Chrome toolbar view. Only supported with Chrome

Usage Instruction: Manipulate / hide the Chrome toolbar.

Threading Constraint: Browser process UI thread.

virtual void SetPreferAccelerators(bool prefer_accelerators) = 0

Parameters:

  • prefer_accelerators: If true, normal-priority accelerators are

Return Value: void.

Usage Instruction: Tune accelerator precedence with respect to web

Threading Constraint: Browser process UI thread.

virtual cef_runtime_style_t GetRuntimeStyle() = 0

Parameters:

  • none.

Return Value: Runtime style (ALLOY or CHROME) for this BrowserView.

Usage Instruction: Determine whether the Chrome toolbar is available,

Threading Constraint: Browser process UI thread.

Usage Example

cpp
CefBrowserSettings settings;
CefRefPtr<CefBrowserView> bv = CefBrowserView::CreateBrowserView(
    client, "https://example.com", settings, nullptr, nullptr, bvd);

CefRefPtr<CefWindow> window = CefWindow::CreateTopLevelWindow(wd);
CefRefPtr<CefFillLayout> fill = window->SetToFillLayout();
window->AddChildView(bv);
window->Show();

See Also

Derived from the CEF C++ headers — © Marshall A. Greenblatt, Google Inc. & contributors (BSD-style license). Not an official CEF project.