Chromium Embedded Framework (CEF)  130.1.2+g48f3ef6+chromium-130.0.6723.44
CefBrowserHost Class Referenceabstract

Class used to represent the browser process aspects of a browser. More...

#include "include/cef_browser.h"

Inheritance diagram for CefBrowserHost:
CefBaseRefCounted

Public Types

typedef cef_drag_operations_mask_t DragOperationsMask
 
typedef cef_file_dialog_mode_t FileDialogMode
 
typedef cef_mouse_button_type_t MouseButtonType
 
typedef cef_paint_element_type_t PaintElementType
 

Public Member Functions

virtual CefRefPtr< CefBrowserGetBrowser ()=0
 Returns the hosted browser object. More...
 
virtual void CloseBrowser (bool force_close)=0
 Request that the browser close. More...
 
virtual bool TryCloseBrowser ()=0
 Helper for closing a browser. More...
 
virtual bool IsReadyToBeClosed ()=0
 Returns true if the browser is ready to be closed, meaning that the close has already been initiated and that JavaScript unload handlers have already executed or should be ignored. More...
 
virtual void SetFocus (bool focus)=0
 Set whether the browser is focused. More...
 
virtual CefWindowHandle GetWindowHandle ()=0
 Retrieve the window handle (if any) for this browser. More...
 
virtual CefWindowHandle GetOpenerWindowHandle ()=0
 Retrieve the window handle (if any) of the browser that opened this browser. More...
 
virtual bool HasView ()=0
 Returns true if this browser is wrapped in a CefBrowserView. More...
 
virtual CefRefPtr< CefClientGetClient ()=0
 Returns the client for this browser. More...
 
virtual CefRefPtr< CefRequestContextGetRequestContext ()=0
 Returns the request context for this browser. More...
 
virtual bool CanZoom (cef_zoom_command_t command)=0
 Returns true if this browser can execute the specified zoom command. More...
 
virtual void Zoom (cef_zoom_command_t command)=0
 Execute a zoom command in this browser. More...
 
virtual double GetDefaultZoomLevel ()=0
 Get the default zoom level. More...
 
virtual double GetZoomLevel ()=0
 Get the current zoom level. More...
 
virtual void SetZoomLevel (double zoomLevel)=0
 Change the zoom level to the specified value. More...
 
virtual void RunFileDialog (FileDialogMode mode, const CefString &title, const CefString &default_file_path, const std::vector< CefString > &accept_filters, CefRefPtr< CefRunFileDialogCallback > callback)=0
 Call to run a file chooser dialog. More...
 
virtual void StartDownload (const CefString &url)=0
 Download the file at |url| using CefDownloadHandler. More...
 
virtual void DownloadImage (const CefString &image_url, bool is_favicon, uint32_t max_image_size, bool bypass_cache, CefRefPtr< CefDownloadImageCallback > callback)=0
 Download |image_url| and execute |callback| on completion with the images received from the renderer. More...
 
virtual void Print ()=0
 Print the current browser contents. More...
 
virtual void PrintToPDF (const CefString &path, const CefPdfPrintSettings &settings, CefRefPtr< CefPdfPrintCallback > callback)=0
 Print the current browser contents to the PDF file specified by |path| and execute |callback| on completion. More...
 
virtual void Find (const CefString &searchText, bool forward, bool matchCase, bool findNext)=0
 Search for |searchText|. More...
 
virtual void StopFinding (bool clearSelection)=0
 Cancel all searches that are currently going on. More...
 
virtual void ShowDevTools (const CefWindowInfo &windowInfo, CefRefPtr< CefClient > client, const CefBrowserSettings &settings, const CefPoint &inspect_element_at)=0
 Open developer tools (DevTools) in its own browser. More...
 
virtual void CloseDevTools ()=0
 Explicitly close the associated DevTools browser, if any. More...
 
virtual bool HasDevTools ()=0
 Returns true if this browser currently has an associated DevTools browser. More...
 
virtual bool SendDevToolsMessage (const void *message, size_t message_size)=0
 Send a method call message over the DevTools protocol. More...
 
virtual int ExecuteDevToolsMethod (int message_id, const CefString &method, CefRefPtr< CefDictionaryValue > params)=0
 Execute a method call over the DevTools protocol. More...
 
virtual CefRefPtr< CefRegistrationAddDevToolsMessageObserver (CefRefPtr< CefDevToolsMessageObserver > observer)=0
 Add an observer for DevTools protocol messages (method results and events). More...
 
virtual void GetNavigationEntries (CefRefPtr< CefNavigationEntryVisitor > visitor, bool current_only)=0
 Retrieve a snapshot of current navigation entries as values sent to the specified visitor. More...
 
virtual void ReplaceMisspelling (const CefString &word)=0
 If a misspelled word is currently selected in an editable node calling this method will replace it with the specified |word|. More...
 
virtual void AddWordToDictionary (const CefString &word)=0
 Add the specified |word| to the spelling dictionary. More...
 
virtual bool IsWindowRenderingDisabled ()=0
 Returns true if window rendering is disabled. More...
 
virtual void WasResized ()=0
 Notify the browser that the widget has been resized. More...
 
virtual void WasHidden (bool hidden)=0
 Notify the browser that it has been hidden or shown. More...
 
virtual void NotifyScreenInfoChanged ()=0
 Send a notification to the browser that the screen info has changed. More...
 
virtual void Invalidate (PaintElementType type)=0
 Invalidate the view. More...
 
virtual void SendExternalBeginFrame ()=0
 Issue a BeginFrame request to Chromium. More...
 
virtual void SendKeyEvent (const CefKeyEvent &event)=0
 Send a key event to the browser. More...
 
virtual void SendMouseClickEvent (const CefMouseEvent &event, MouseButtonType type, bool mouseUp, int clickCount)=0
 Send a mouse click event to the browser. More...
 
virtual void SendMouseMoveEvent (const CefMouseEvent &event, bool mouseLeave)=0
 Send a mouse move event to the browser. More...
 
virtual void SendMouseWheelEvent (const CefMouseEvent &event, int deltaX, int deltaY)=0
 Send a mouse wheel event to the browser. More...
 
virtual void SendTouchEvent (const CefTouchEvent &event)=0
 Send a touch event to the browser for a windowless browser. More...
 
virtual void SendCaptureLostEvent ()=0
 Send a capture lost event to the browser. More...
 
virtual void NotifyMoveOrResizeStarted ()=0
 Notify the browser that the window hosting it is about to be moved or resized. More...
 
virtual int GetWindowlessFrameRate ()=0
 Returns the maximum rate in frames per second (fps) that CefRenderHandler::OnPaint will be called for a windowless browser. More...
 
virtual void SetWindowlessFrameRate (int frame_rate)=0
 Set the maximum rate in frames per second (fps) that CefRenderHandler:: OnPaint will be called for a windowless browser. More...
 
virtual void ImeSetComposition (const CefString &text, const std::vector< CefCompositionUnderline > &underlines, const CefRange &replacement_range, const CefRange &selection_range)=0
 Begins a new composition or updates the existing composition. More...
 
virtual void ImeCommitText (const CefString &text, const CefRange &replacement_range, int relative_cursor_pos)=0
 Completes the existing composition by optionally inserting the specified |text| into the composition node. More...
 
virtual void ImeFinishComposingText (bool keep_selection)=0
 Completes the existing composition by applying the current composition node contents. More...
 
virtual void ImeCancelComposition ()=0
 Cancels the existing composition and discards the composition node contents without applying them. More...
 
virtual void DragTargetDragEnter (CefRefPtr< CefDragData > drag_data, const CefMouseEvent &event, DragOperationsMask allowed_ops)=0
 Call this method when the user drags the mouse into the web view (before calling DragTargetDragOver/DragTargetLeave/DragTargetDrop). More...
 
virtual void DragTargetDragOver (const CefMouseEvent &event, DragOperationsMask allowed_ops)=0
 Call this method each time the mouse is moved across the web view during a drag operation (after calling DragTargetDragEnter and before calling DragTargetDragLeave/DragTargetDrop). More...
 
virtual void DragTargetDragLeave ()=0
 Call this method when the user drags the mouse out of the web view (after calling DragTargetDragEnter). More...
 
virtual void DragTargetDrop (const CefMouseEvent &event)=0
 Call this method when the user completes the drag operation by dropping the object onto the web view (after calling DragTargetDragEnter). More...
 
virtual void DragSourceEndedAt (int x, int y, DragOperationsMask op)=0
 Call this method when the drag operation started by a CefRenderHandler::StartDragging call has ended either in a drop or by being cancelled. More...
 
virtual void DragSourceSystemDragEnded ()=0
 Call this method when the drag operation started by a CefRenderHandler::StartDragging call has completed. More...
 
virtual CefRefPtr< CefNavigationEntryGetVisibleNavigationEntry ()=0
 Returns the current visible navigation entry for this browser. More...
 
virtual void SetAccessibilityState (cef_state_t accessibility_state)=0
 Set accessibility state for all frames. More...
 
virtual void SetAutoResizeEnabled (bool enabled, const CefSize &min_size, const CefSize &max_size)=0
 Enable notifications of auto resize via CefDisplayHandler::OnAutoResize. More...
 
virtual void SetAudioMuted (bool mute)=0
 Set whether the browser's audio is muted. More...
 
virtual bool IsAudioMuted ()=0
 Returns true if the browser's audio is muted. More...
 
virtual bool IsFullscreen ()=0
 Returns true if the renderer is currently in browser fullscreen. More...
 
virtual void ExitFullscreen (bool will_cause_resize)=0
 Requests the renderer to exit browser fullscreen. More...
 
virtual bool CanExecuteChromeCommand (int command_id)=0
 Returns true if a Chrome command is supported and enabled. More...
 
virtual void ExecuteChromeCommand (int command_id, cef_window_open_disposition_t disposition)=0
 Execute a Chrome command. More...
 
virtual bool IsRenderProcessUnresponsive ()=0
 Returns true if the render process associated with this browser is currently unresponsive as indicated by a lack of input event processing for at least 15 seconds. More...
 
virtual cef_runtime_style_t GetRuntimeStyle ()=0
 Returns the runtime style for this browser (ALLOY or CHROME). More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Static Public Member Functions

static bool CreateBrowser (const CefWindowInfo &windowInfo, CefRefPtr< CefClient > client, const CefString &url, const CefBrowserSettings &settings, CefRefPtr< CefDictionaryValue > extra_info, CefRefPtr< CefRequestContext > request_context)
 Create a new browser using the window parameters specified by |windowInfo|. More...
 
static CefRefPtr< CefBrowserCreateBrowserSync (const CefWindowInfo &windowInfo, CefRefPtr< CefClient > client, const CefString &url, const CefBrowserSettings &settings, CefRefPtr< CefDictionaryValue > extra_info, CefRefPtr< CefRequestContext > request_context)
 Create a new browser using the window parameters specified by |windowInfo|. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed Description

Class used to represent the browser process aspects of a browser.

The methods of this class can only be called in the browser process. They may be called on any thread in that process unless otherwise indicated in the comments.

Member Typedef Documentation

◆ DragOperationsMask

◆ FileDialogMode

◆ MouseButtonType

◆ PaintElementType

Member Function Documentation

◆ AddDevToolsMessageObserver()

virtual CefRefPtr<CefRegistration> CefBrowserHost::AddDevToolsMessageObserver ( CefRefPtr< CefDevToolsMessageObserver observer)
pure virtual

Add an observer for DevTools protocol messages (method results and events).

The observer will remain registered until the returned Registration object is destroyed. See the SendDevToolsMessage documentation for additional usage information.

◆ AddWordToDictionary()

virtual void CefBrowserHost::AddWordToDictionary ( const CefString word)
pure virtual

Add the specified |word| to the spelling dictionary.

◆ CanExecuteChromeCommand()

virtual bool CefBrowserHost::CanExecuteChromeCommand ( int  command_id)
pure virtual

Returns true if a Chrome command is supported and enabled.

Values for |command_id| can be found in the cef_command_ids.h file. This method can only be called on the UI thread. Only used with Chrome style.

◆ CanZoom()

virtual bool CefBrowserHost::CanZoom ( cef_zoom_command_t  command)
pure virtual

Returns true if this browser can execute the specified zoom command.

This method can only be called on the UI thread.

◆ CloseBrowser()

virtual void CefBrowserHost::CloseBrowser ( bool  force_close)
pure virtual

Request that the browser close.

Closing a browser is a multi-stage process that may complete either synchronously or asynchronously, and involves callbacks such as CefLifeSpanHandler::DoClose (Alloy style only), CefLifeSpanHandler::OnBeforeClose, and a top-level window close handler such as CefWindowDelegate::CanClose (or platform-specific equivalent). In some cases a close request may be delayed or canceled by the user. Using TryCloseBrowser() instead of CloseBrowser() is recommended for most use cases. See CefLifeSpanHandler::DoClose() documentation for detailed usage and examples.

If |force_close| is false then JavaScript unload handlers, if any, may be fired and the close may be delayed or canceled by the user. If |force_close| is true then the user will not be prompted and the close will proceed immediately (possibly asynchronously). If browser close is delayed and not canceled the default behavior is to call the top-level window close handler once the browser is ready to be closed. This default behavior can be changed for Alloy style browsers by implementing CefLifeSpanHandler::DoClose(). IsReadyToBeClosed() can be used to detect mandatory browser close events when customizing close behavior on the browser process UI thread.

◆ CloseDevTools()

virtual void CefBrowserHost::CloseDevTools ( )
pure virtual

Explicitly close the associated DevTools browser, if any.

◆ CreateBrowser()

static bool CefBrowserHost::CreateBrowser ( const CefWindowInfo windowInfo,
CefRefPtr< CefClient client,
const CefString url,
const CefBrowserSettings settings,
CefRefPtr< CefDictionaryValue extra_info,
CefRefPtr< CefRequestContext request_context 
)
static

Create a new browser using the window parameters specified by |windowInfo|.

All values will be copied internally and the actual window (if any) will be created on the UI thread. If |request_context| is empty the global request context will be used. This method can be called on any browser process thread and will not block. The optional |extra_info| parameter provides an opportunity to specify extra information specific to the created browser that will be passed to CefRenderProcessHandler::OnBrowserCreated() in the render process.

◆ CreateBrowserSync()

static CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync ( const CefWindowInfo windowInfo,
CefRefPtr< CefClient client,
const CefString url,
const CefBrowserSettings settings,
CefRefPtr< CefDictionaryValue extra_info,
CefRefPtr< CefRequestContext request_context 
)
static

Create a new browser using the window parameters specified by |windowInfo|.

If |request_context| is empty the global request context will be used. This method can only be called on the browser process UI thread. The optional |extra_info| parameter provides an opportunity to specify extra information specific to the created browser that will be passed to CefRenderProcessHandler::OnBrowserCreated() in the render process.

◆ DownloadImage()

virtual void CefBrowserHost::DownloadImage ( const CefString image_url,
bool  is_favicon,
uint32_t  max_image_size,
bool  bypass_cache,
CefRefPtr< CefDownloadImageCallback callback 
)
pure virtual

Download |image_url| and execute |callback| on completion with the images received from the renderer.

If |is_favicon| is true then cookies are not sent and not accepted during download. Images with density independent pixel (DIP) sizes larger than |max_image_size| are filtered out from the image results. Versions of the image at different scale factors may be downloaded up to the maximum scale factor supported by the system. If there are no image results <= |max_image_size| then the smallest image is resized to |max_image_size| and is the only result. A |max_image_size| of 0 means unlimited. If |bypass_cache| is true then |image_url| is requested from the server even if it is present in the browser cache.

◆ DragSourceEndedAt()

virtual void CefBrowserHost::DragSourceEndedAt ( int  x,
int  y,
DragOperationsMask  op 
)
pure virtual

Call this method when the drag operation started by a CefRenderHandler::StartDragging call has ended either in a drop or by being cancelled.

|x| and |y| are mouse coordinates relative to the upper-left corner of the view. If the web view is both the drag source and the drag target then all DragTarget* methods should be called before DragSource* mthods. This method is only used when window rendering is disabled.

◆ DragSourceSystemDragEnded()

virtual void CefBrowserHost::DragSourceSystemDragEnded ( )
pure virtual

Call this method when the drag operation started by a CefRenderHandler::StartDragging call has completed.

This method may be called immediately without first calling DragSourceEndedAt to cancel a drag operation. If the web view is both the drag source and the drag target then all DragTarget* methods should be called before DragSource* mthods. This method is only used when window rendering is disabled.

◆ DragTargetDragEnter()

virtual void CefBrowserHost::DragTargetDragEnter ( CefRefPtr< CefDragData drag_data,
const CefMouseEvent event,
DragOperationsMask  allowed_ops 
)
pure virtual

Call this method when the user drags the mouse into the web view (before calling DragTargetDragOver/DragTargetLeave/DragTargetDrop).

|drag_data| should not contain file contents as this type of data is not allowed to be dragged into the web view. File contents can be removed using CefDragData::ResetFileContents (for example, if |drag_data| comes from CefRenderHandler::StartDragging). This method is only used when window rendering is disabled.

◆ DragTargetDragLeave()

virtual void CefBrowserHost::DragTargetDragLeave ( )
pure virtual

Call this method when the user drags the mouse out of the web view (after calling DragTargetDragEnter).

This method is only used when window rendering is disabled.

◆ DragTargetDragOver()

virtual void CefBrowserHost::DragTargetDragOver ( const CefMouseEvent event,
DragOperationsMask  allowed_ops 
)
pure virtual

Call this method each time the mouse is moved across the web view during a drag operation (after calling DragTargetDragEnter and before calling DragTargetDragLeave/DragTargetDrop).

This method is only used when window rendering is disabled.

◆ DragTargetDrop()

virtual void CefBrowserHost::DragTargetDrop ( const CefMouseEvent event)
pure virtual

Call this method when the user completes the drag operation by dropping the object onto the web view (after calling DragTargetDragEnter).

The object being dropped is |drag_data|, given as an argument to the previous DragTargetDragEnter call. This method is only used when window rendering is disabled.

◆ ExecuteChromeCommand()

virtual void CefBrowserHost::ExecuteChromeCommand ( int  command_id,
cef_window_open_disposition_t  disposition 
)
pure virtual

Execute a Chrome command.

Values for |command_id| can be found in the cef_command_ids.h file. |disposition| provides information about the intended command target. Only used with Chrome style.

◆ ExecuteDevToolsMethod()

virtual int CefBrowserHost::ExecuteDevToolsMethod ( int  message_id,
const CefString method,
CefRefPtr< CefDictionaryValue params 
)
pure virtual

Execute a method call over the DevTools protocol.

This is a more structured version of SendDevToolsMessage. |message_id| is an incremental number that uniquely identifies the message (pass 0 to have the next number assigned automatically based on previous values). |method| is the method name. |params| are the method parameters, which may be empty. See the DevTools protocol documentation (linked above) for details of supported methods and the expected |params| dictionary contents. This method will return the assigned message ID if called on the UI thread and the message was successfully submitted for validation, otherwise 0. See the SendDevToolsMessage documentation for additional usage information.

◆ ExitFullscreen()

virtual void CefBrowserHost::ExitFullscreen ( bool  will_cause_resize)
pure virtual

Requests the renderer to exit browser fullscreen.

In most cases exiting window fullscreen should also exit browser fullscreen. With Alloy style this method should be called in response to a user action such as clicking the green traffic light button on MacOS (CefWindowDelegate::OnWindowFullscreenTransition callback) or pressing the "ESC" key (CefKeyboardHandler::OnPreKeyEvent callback). With Chrome style these standard exit actions are handled internally but new/additional user actions can use this method. Set |will_cause_resize| to true if exiting browser fullscreen will cause a view resize.

◆ Find()

virtual void CefBrowserHost::Find ( const CefString searchText,
bool  forward,
bool  matchCase,
bool  findNext 
)
pure virtual

Search for |searchText|.

|forward| indicates whether to search forward or backward within the page. |matchCase| indicates whether the search should be case-sensitive. |findNext| indicates whether this is the first request or a follow-up. The search will be restarted if |searchText| or |matchCase| change. The search will be stopped if |searchText| is empty. The CefFindHandler instance, if any, returned via CefClient::GetFindHandler will be called to report find results.

◆ GetBrowser()

virtual CefRefPtr<CefBrowser> CefBrowserHost::GetBrowser ( )
pure virtual

Returns the hosted browser object.

◆ GetClient()

virtual CefRefPtr<CefClient> CefBrowserHost::GetClient ( )
pure virtual

Returns the client for this browser.

◆ GetDefaultZoomLevel()

virtual double CefBrowserHost::GetDefaultZoomLevel ( )
pure virtual

Get the default zoom level.

This value will be 0.0 by default but can be configured. This method can only be called on the UI thread.

◆ GetNavigationEntries()

virtual void CefBrowserHost::GetNavigationEntries ( CefRefPtr< CefNavigationEntryVisitor visitor,
bool  current_only 
)
pure virtual

Retrieve a snapshot of current navigation entries as values sent to the specified visitor.

If |current_only| is true only the current navigation entry will be sent, otherwise all navigation entries will be sent.

◆ GetOpenerWindowHandle()

virtual CefWindowHandle CefBrowserHost::GetOpenerWindowHandle ( )
pure virtual

Retrieve the window handle (if any) of the browser that opened this browser.

Will return NULL for non-popup browsers or if this browser is wrapped in a CefBrowserView. This method can be used in combination with custom handling of modal windows.

◆ GetRequestContext()

virtual CefRefPtr<CefRequestContext> CefBrowserHost::GetRequestContext ( )
pure virtual

Returns the request context for this browser.

◆ GetRuntimeStyle()

virtual cef_runtime_style_t CefBrowserHost::GetRuntimeStyle ( )
pure virtual

Returns the runtime style for this browser (ALLOY or CHROME).

See cef_runtime_style_t documentation for details.

◆ GetVisibleNavigationEntry()

virtual CefRefPtr<CefNavigationEntry> CefBrowserHost::GetVisibleNavigationEntry ( )
pure virtual

Returns the current visible navigation entry for this browser.

This method can only be called on the UI thread.

◆ GetWindowHandle()

virtual CefWindowHandle CefBrowserHost::GetWindowHandle ( )
pure virtual

Retrieve the window handle (if any) for this browser.

If this browser is wrapped in a CefBrowserView this method should be called on the browser process UI thread and it will return the handle for the top-level native window.

◆ GetWindowlessFrameRate()

virtual int CefBrowserHost::GetWindowlessFrameRate ( )
pure virtual

Returns the maximum rate in frames per second (fps) that CefRenderHandler::OnPaint will be called for a windowless browser.

The actual fps may be lower if the browser cannot generate frames at the requested rate. The minimum value is 1 and the maximum value is 60 (default 30). This method can only be called on the UI thread.

◆ GetZoomLevel()

virtual double CefBrowserHost::GetZoomLevel ( )
pure virtual

Get the current zoom level.

This method can only be called on the UI thread.

◆ HasDevTools()

virtual bool CefBrowserHost::HasDevTools ( )
pure virtual

Returns true if this browser currently has an associated DevTools browser.

Must be called on the browser process UI thread.

◆ HasView()

virtual bool CefBrowserHost::HasView ( )
pure virtual

Returns true if this browser is wrapped in a CefBrowserView.

◆ ImeCancelComposition()

virtual void CefBrowserHost::ImeCancelComposition ( )
pure virtual

Cancels the existing composition and discards the composition node contents without applying them.

See comments on ImeSetComposition for usage. This method is only used when window rendering is disabled.

◆ ImeCommitText()

virtual void CefBrowserHost::ImeCommitText ( const CefString text,
const CefRange replacement_range,
int  relative_cursor_pos 
)
pure virtual

Completes the existing composition by optionally inserting the specified |text| into the composition node.

|replacement_range| is an optional range of the existing text that will be replaced. |relative_cursor_pos| is where the cursor will be positioned relative to the current cursor position. See comments on ImeSetComposition for usage. The |replacement_range| and |relative_cursor_pos| values are only used on OS X. This method is only used when window rendering is disabled.

◆ ImeFinishComposingText()

virtual void CefBrowserHost::ImeFinishComposingText ( bool  keep_selection)
pure virtual

Completes the existing composition by applying the current composition node contents.

If |keep_selection| is false the current selection, if any, will be discarded. See comments on ImeSetComposition for usage. This method is only used when window rendering is disabled.

◆ ImeSetComposition()

virtual void CefBrowserHost::ImeSetComposition ( const CefString text,
const std::vector< CefCompositionUnderline > &  underlines,
const CefRange replacement_range,
const CefRange selection_range 
)
pure virtual

Begins a new composition or updates the existing composition.

Blink has a special node (a composition node) that allows the input method to change text without affecting other DOM nodes. |text| is the optional text that will be inserted into the composition node. |underlines| is an optional set of ranges that will be underlined in the resulting text. |replacement_range| is an optional range of the existing text that will be replaced. |selection_range| is an optional range of the resulting text that will be selected after insertion or replacement. The |replacement_range| value is only used on OS X.

This method may be called multiple times as the composition changes. When the client is done making changes the composition should either be canceled or completed. To cancel the composition call ImeCancelComposition. To complete the composition call either ImeCommitText or ImeFinishComposingText. Completion is usually signaled when:

  1. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR flag (on Windows), or;
  2. The client receives a "commit" signal of GtkIMContext (on Linux), or;
  3. insertText of NSTextInput is called (on Mac).

This method is only used when window rendering is disabled.

◆ Invalidate()

virtual void CefBrowserHost::Invalidate ( PaintElementType  type)
pure virtual

Invalidate the view.

The browser will call CefRenderHandler::OnPaint asynchronously. This method is only used when window rendering is disabled.

◆ IsAudioMuted()

virtual bool CefBrowserHost::IsAudioMuted ( )
pure virtual

Returns true if the browser's audio is muted.

This method can only be called on the UI thread.

◆ IsFullscreen()

virtual bool CefBrowserHost::IsFullscreen ( )
pure virtual

Returns true if the renderer is currently in browser fullscreen.

This differs from window fullscreen in that browser fullscreen is entered using the JavaScript Fullscreen API and modifies CSS attributes such as the ::backdrop pseudo-element and :fullscreen pseudo-class. This method can only be called on the UI thread.

◆ IsReadyToBeClosed()

virtual bool CefBrowserHost::IsReadyToBeClosed ( )
pure virtual

Returns true if the browser is ready to be closed, meaning that the close has already been initiated and that JavaScript unload handlers have already executed or should be ignored.

This can be used from a top-level window close handler such as CefWindowDelegate::CanClose (or platform-specific equivalent) to distringuish between potentially cancelable browser close events (like the user clicking the top-level window close button before browser close has started) and mandatory browser close events (like JavaScript window.close() or after browser close has started in response to [Try]CloseBrowser()). Not completing the browser close for mandatory close events (when this method returns true) will leave the browser in a partially closed state that interferes with proper functioning. See CloseBrowser() documentation for additional usage information. This method must be called on the browser process UI thread.

◆ IsRenderProcessUnresponsive()

virtual bool CefBrowserHost::IsRenderProcessUnresponsive ( )
pure virtual

Returns true if the render process associated with this browser is currently unresponsive as indicated by a lack of input event processing for at least 15 seconds.

To receive associated state change notifications and optionally handle an unresponsive render process implement CefRequestHandler::OnRenderProcessUnresponsive. This method can only be called on the UI thread.

◆ IsWindowRenderingDisabled()

virtual bool CefBrowserHost::IsWindowRenderingDisabled ( )
pure virtual

Returns true if window rendering is disabled.

◆ NotifyMoveOrResizeStarted()

virtual void CefBrowserHost::NotifyMoveOrResizeStarted ( )
pure virtual

Notify the browser that the window hosting it is about to be moved or resized.

This method is only used on Windows and Linux.

◆ NotifyScreenInfoChanged()

virtual void CefBrowserHost::NotifyScreenInfoChanged ( )
pure virtual

Send a notification to the browser that the screen info has changed.

The browser will then call CefRenderHandler::GetScreenInfo to update the screen information with the new values. This simulates moving the webview window from one display to another, or changing the properties of the current display. This method is only used when window rendering is disabled.

◆ Print()

virtual void CefBrowserHost::Print ( )
pure virtual

Print the current browser contents.

◆ PrintToPDF()

virtual void CefBrowserHost::PrintToPDF ( const CefString path,
const CefPdfPrintSettings settings,
CefRefPtr< CefPdfPrintCallback callback 
)
pure virtual

Print the current browser contents to the PDF file specified by |path| and execute |callback| on completion.

The caller is responsible for deleting |path| when done. For PDF printing to work on Linux you must implement the CefPrintHandler::GetPdfPaperSize method.

◆ ReplaceMisspelling()

virtual void CefBrowserHost::ReplaceMisspelling ( const CefString word)
pure virtual

If a misspelled word is currently selected in an editable node calling this method will replace it with the specified |word|.

◆ RunFileDialog()

virtual void CefBrowserHost::RunFileDialog ( FileDialogMode  mode,
const CefString title,
const CefString default_file_path,
const std::vector< CefString > &  accept_filters,
CefRefPtr< CefRunFileDialogCallback callback 
)
pure virtual

Call to run a file chooser dialog.

Only a single file chooser dialog may be pending at any given time. |mode| represents the type of dialog to display. |title| to the title to be used for the dialog and may be empty to show the default title ("Open" or "Save" depending on the mode). |default_file_path| is the path with optional directory and/or file name component that will be initially selected in the dialog. |accept_filters| are used to restrict the selectable file types and may any combination of (a) valid lower-cased MIME types (e.g. "text/*" or "image/*"), (b) individual file extensions (e.g. ".txt" or ".png"), or (c) combined description and file extension delimited using "|" and ";" (e.g. "Image Types|.png;.gif;.jpg"). |callback| will be executed after the dialog is dismissed or immediately if another dialog is already pending. The dialog will be initiated asynchronously on the UI thread.

◆ SendCaptureLostEvent()

virtual void CefBrowserHost::SendCaptureLostEvent ( )
pure virtual

Send a capture lost event to the browser.

◆ SendDevToolsMessage()

virtual bool CefBrowserHost::SendDevToolsMessage ( const void *  message,
size_t  message_size 
)
pure virtual

Send a method call message over the DevTools protocol.

|message| must be a UTF8-encoded JSON dictionary that contains "id" (int), "method" (string) and "params" (dictionary, optional) values. See the DevTools protocol documentation at https://chromedevtools.github.io/devtools-protocol/ for details of supported methods and the expected "params" dictionary contents. |message| will be copied if necessary. This method will return true if called on the UI thread and the message was successfully submitted for validation, otherwise false. Validation will be applied asynchronously and any messages that fail due to formatting errors or missing parameters may be discarded without notification. Prefer ExecuteDevToolsMethod if a more structured approach to message formatting is desired.

Every valid method call will result in an asynchronous method result or error message that references the sent message "id". Event messages are received while notifications are enabled (for example, between method calls for "Page.enable" and "Page.disable"). All received messages will be delivered to the observer(s) registered with AddDevToolsMessageObserver. See CefDevToolsMessageObserver::OnDevToolsMessage documentation for details of received message contents.

Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and AddDevToolsMessageObserver methods does not require an active DevTools front-end or remote-debugging session. Other active DevTools sessions will continue to function independently. However, any modification of global browser state by one session may not be reflected in the UI of other sessions.

Communication with the DevTools front-end (when displayed) can be logged for development purposes by passing the --devtools-protocol-log-file=<path> command-line flag.

◆ SendExternalBeginFrame()

virtual void CefBrowserHost::SendExternalBeginFrame ( )
pure virtual

Issue a BeginFrame request to Chromium.

Only valid when CefWindowInfo::external_begin_frame_enabled is set to true.

◆ SendKeyEvent()

virtual void CefBrowserHost::SendKeyEvent ( const CefKeyEvent event)
pure virtual

Send a key event to the browser.

◆ SendMouseClickEvent()

virtual void CefBrowserHost::SendMouseClickEvent ( const CefMouseEvent event,
MouseButtonType  type,
bool  mouseUp,
int  clickCount 
)
pure virtual

Send a mouse click event to the browser.

The |x| and |y| coordinates are relative to the upper-left corner of the view.

◆ SendMouseMoveEvent()

virtual void CefBrowserHost::SendMouseMoveEvent ( const CefMouseEvent event,
bool  mouseLeave 
)
pure virtual

Send a mouse move event to the browser.

The |x| and |y| coordinates are relative to the upper-left corner of the view.

◆ SendMouseWheelEvent()

virtual void CefBrowserHost::SendMouseWheelEvent ( const CefMouseEvent event,
int  deltaX,
int  deltaY 
)
pure virtual

Send a mouse wheel event to the browser.

The |x| and |y| coordinates are relative to the upper-left corner of the view. The |deltaX| and |deltaY| values represent the movement delta in the X and Y directions respectively. In order to scroll inside select popups with window rendering disabled CefRenderHandler::GetScreenPoint should be implemented properly.

◆ SendTouchEvent()

virtual void CefBrowserHost::SendTouchEvent ( const CefTouchEvent event)
pure virtual

Send a touch event to the browser for a windowless browser.

◆ SetAccessibilityState()

virtual void CefBrowserHost::SetAccessibilityState ( cef_state_t  accessibility_state)
pure virtual

Set accessibility state for all frames.

|accessibility_state| may be default, enabled or disabled. If |accessibility_state| is STATE_DEFAULT then accessibility will be disabled by default and the state may be further controlled with the "force-renderer-accessibility" and "disable-renderer-accessibility" command-line switches. If |accessibility_state| is STATE_ENABLED then accessibility will be enabled. If |accessibility_state| is STATE_DISABLED then accessibility will be completely disabled.

For windowed browsers accessibility will be enabled in Complete mode (which corresponds to kAccessibilityModeComplete in Chromium). In this mode all platform accessibility objects will be created and managed by Chromium's internal implementation. The client needs only to detect the screen reader and call this method appropriately. For example, on macOS the client can handle the "AXEnhancedUserInterface" accessibility attribute to detect VoiceOver state changes and on Windows the client can handle WM_GETOBJECT with OBJID_CLIENT to detect accessibility readers.

For windowless browsers accessibility will be enabled in TreeOnly mode (which corresponds to kAccessibilityModeWebContentsOnly in Chromium). In this mode renderer accessibility is enabled, the full tree is computed, and events are passed to CefAccessibiltyHandler, but platform accessibility objects are not created. The client may implement platform accessibility objects using CefAccessibiltyHandler callbacks if desired.

◆ SetAudioMuted()

virtual void CefBrowserHost::SetAudioMuted ( bool  mute)
pure virtual

Set whether the browser's audio is muted.

◆ SetAutoResizeEnabled()

virtual void CefBrowserHost::SetAutoResizeEnabled ( bool  enabled,
const CefSize min_size,
const CefSize max_size 
)
pure virtual

Enable notifications of auto resize via CefDisplayHandler::OnAutoResize.

Notifications are disabled by default. |min_size| and |max_size| define the range of allowed sizes.

◆ SetFocus()

virtual void CefBrowserHost::SetFocus ( bool  focus)
pure virtual

Set whether the browser is focused.

◆ SetWindowlessFrameRate()

virtual void CefBrowserHost::SetWindowlessFrameRate ( int  frame_rate)
pure virtual

Set the maximum rate in frames per second (fps) that CefRenderHandler:: OnPaint will be called for a windowless browser.

The actual fps may be lower if the browser cannot generate frames at the requested rate. The minimum value is 1 and the maximum value is 60 (default 30). Can also be set at browser creation via CefBrowserSettings.windowless_frame_rate.

◆ SetZoomLevel()

virtual void CefBrowserHost::SetZoomLevel ( double  zoomLevel)
pure virtual

Change the zoom level to the specified value.

Specify 0.0 to reset the zoom level to the default. If called on the UI thread the change will be applied immediately. Otherwise, the change will be applied asynchronously on the UI thread.

◆ ShowDevTools()

virtual void CefBrowserHost::ShowDevTools ( const CefWindowInfo windowInfo,
CefRefPtr< CefClient client,
const CefBrowserSettings settings,
const CefPoint inspect_element_at 
)
pure virtual

Open developer tools (DevTools) in its own browser.

The DevTools browser will remain associated with this browser. If the DevTools browser is already open then it will be focused, in which case the |windowInfo|, |client| and |settings| parameters will be ignored. If |inspect_element_at| is non-empty then the element at the specified (x,y) location will be inspected. The |windowInfo| parameter will be ignored if this browser is wrapped in a CefBrowserView.

◆ StartDownload()

virtual void CefBrowserHost::StartDownload ( const CefString url)
pure virtual

Download the file at |url| using CefDownloadHandler.

◆ StopFinding()

virtual void CefBrowserHost::StopFinding ( bool  clearSelection)
pure virtual

Cancel all searches that are currently going on.

◆ TryCloseBrowser()

virtual bool CefBrowserHost::TryCloseBrowser ( )
pure virtual

Helper for closing a browser.

This is similar in behavior to CLoseBrowser(false) but returns a boolean to reflect the immediate close status. Call this method from a top-level window close handler such as CefWindowDelegate::CanClose (or platform-specific equivalent) to request that the browser close, and return the result to indicate if the window close should proceed. Returns false if the close will be delayed (JavaScript unload handlers triggered but still pending) or true if the close will proceed immediately (possibly asynchronously). See CloseBrowser() documentation for additional usage information. This method must be called on the browser process UI thread.

◆ WasHidden()

virtual void CefBrowserHost::WasHidden ( bool  hidden)
pure virtual

Notify the browser that it has been hidden or shown.

Layouting and CefRenderHandler::OnPaint notification will stop when the browser is hidden. This method is only used when window rendering is disabled.

◆ WasResized()

virtual void CefBrowserHost::WasResized ( )
pure virtual

Notify the browser that the widget has been resized.

The browser will first call CefRenderHandler::GetViewRect to get the new size and then call CefRenderHandler::OnPaint asynchronously with the updated regions. This method is only used when window rendering is disabled.

◆ Zoom()

virtual void CefBrowserHost::Zoom ( cef_zoom_command_t  command)
pure virtual

Execute a zoom command in this browser.

If called on the UI thread the change will be applied immediately. Otherwise, the change will be applied asynchronously on the UI thread.


The documentation for this class was generated from the following file: