cef_browser_host_t

Structure used to represent the browser process aspects of a browser. The functions of this structure can only be called in the browser process. They may be called on any thread in that process unless otherwise indicated in the comments.

version(cef && embedded_cef_bindings)
extern (C)
struct cef_browser_host_t {}

Members

Variables

add_dev_tools_message_observer
cef_registration_t* function(cef_browser_host_t* self, cef_dev_tools_message_observer_t* observer) nothrow add_dev_tools_message_observer;

Add an observer for DevTools protocol messages (function results and events). The observer will remain registered until the returned Registration object is destroyed. See the SendDevToolsMessage documentation for additional usage information.

add_word_to_dictionary
void function(cef_browser_host_t* self, const(cef_string_t)* word) nothrow add_word_to_dictionary;

Add the specified |word| to the spelling dictionary.

base
cef_base_ref_counted_t base;

Base structure.

can_execute_chrome_command
int function(cef_browser_host_t* self, int command_id) nothrow can_execute_chrome_command;

Returns true (1) if a Chrome command is supported and enabled. Values for |command_id| can be found in the cef_command_ids.h file. This function can only be called on the UI thread. Only used with the Chrome runtime.

can_zoom
int function(cef_browser_host_t* self, cef_zoom_command_t command) nothrow can_zoom;

Returns true (1) if this browser can execute the specified zoom command. This function can only be called on the UI thread.

close_browser
void function(cef_browser_host_t* self, int force_close) nothrow close_browser;

Request that the browser close. The JavaScript 'onbeforeunload' event will be fired. If |force_close| is false (0) the event handler, if any, will be allowed to prompt the user and the user can optionally cancel the close. If |force_close| is true (1) the prompt will not be displayed and the close will proceed. Results in a call to

close_dev_tools
void function(cef_browser_host_t* self) nothrow close_dev_tools;

Explicitly close the associated DevTools browser, if any.

download_image
void function(cef_browser_host_t* self, const(cef_string_t)* image_url, int is_favicon, uint max_image_size, int bypass_cache, cef_download_image_callback_t* callback) nothrow download_image;

Download |image_url| and execute |callback| on completion with the images received from the renderer. If |is_favicon| is true (1) 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 (1) then |image_url| is requested from the server even if it is present in the browser cache.

drag_source_ended_at
void function(cef_browser_host_t* self, int x, int y, cef_drag_operations_mask_t op) nothrow drag_source_ended_at;

Call this function when the drag operation started by a

drag_source_system_drag_ended
void function(cef_browser_host_t* self) nothrow drag_source_system_drag_ended;

Call this function when the drag operation started by a

drag_target_drag_enter
void function(cef_browser_host_t* self, cef_drag_data_t* drag_data, const(cef_mouse_event_t)* event, cef_drag_operations_mask_t allowed_ops) nothrow drag_target_drag_enter;

Call this function 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

drag_target_drag_leave
void function(cef_browser_host_t* self) nothrow drag_target_drag_leave;

Call this function when the user drags the mouse out of the web view (after calling DragTargetDragEnter). This function is only used when window rendering is disabled.

drag_target_drag_over
void function(cef_browser_host_t* self, const(cef_mouse_event_t)* event, cef_drag_operations_mask_t allowed_ops) nothrow drag_target_drag_over;

Call this function each time the mouse is moved across the web view during a drag operation (after calling DragTargetDragEnter and before calling DragTargetDragLeave/DragTargetDrop). This function is only used when window rendering is disabled.

drag_target_drop
void function(cef_browser_host_t* self, const(cef_mouse_event_t)* event) nothrow drag_target_drop;

Call this function 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 function is only used when window rendering is disabled.

execute_chrome_command
void function(cef_browser_host_t* self, int command_id, cef_window_open_disposition_t disposition) nothrow execute_chrome_command;

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 the Chrome runtime.

execute_dev_tools_method
int function(cef_browser_host_t* self, int message_id, const(cef_string_t)* method, cef_dictionary_value_t* params) nothrow execute_dev_tools_method;

Execute a function 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). |function| is the function name. |params| are the function parameters, which may be NULL. See the DevTools protocol documentation (linked above) for details of supported functions and the expected |params| dictionary contents. This function 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.

exit_fullscreen
void function(cef_browser_host_t* self, int will_cause_resize) nothrow exit_fullscreen;

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

find
void function(cef_browser_host_t* self, const(cef_string_t)* searchText, int forward, int matchCase, int findNext) nothrow find;

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 NULL. The cef_find_handler_t instance, if any, returned via

get_browser
cef_browser_t* function(cef_browser_host_t* self) nothrow get_browser;

Returns the hosted browser object.

get_client
cef_client_t* function(cef_browser_host_t* self) nothrow get_client;

Returns the client for this browser.

get_default_zoom_level
double function(cef_browser_host_t* self) nothrow get_default_zoom_level;

Get the default zoom level. This value will be 0.0 by default but can be configured with the Chrome runtime. This function can only be called on the UI thread.

get_extension
cef_extension_t* function(cef_browser_host_t* self) nothrow get_extension;

Returns the extension hosted in this browser or NULL if no extension is hosted. See cef_request_context_t::LoadExtension for details.

get_navigation_entries
void function(cef_browser_host_t* self, cef_navigation_entry_visitor_t* visitor, int current_only) nothrow get_navigation_entries;

Retrieve a snapshot of current navigation entries as values sent to the specified visitor. If |current_only| is true (1) only the current navigation entry will be sent, otherwise all navigation entries will be sent.

get_opener_window_handle
c_ulong function(cef_browser_host_t* self) nothrow get_opener_window_handle;

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 cef_browser_view_t. This function can be used in combination with custom handling of modal windows.

get_request_context
cef_request_context_t* function(cef_browser_host_t* self) nothrow get_request_context;

Returns the request context for this browser.

get_runtime_style
cef_runtime_style_t function(cef_browser_host_t* self) nothrow get_runtime_style;

Returns the runtime style for this browser (ALLOY or CHROME). See cef_runtime_style_t documentation for details.

get_visible_navigation_entry
cef_navigation_entry_t* function(cef_browser_host_t* self) nothrow get_visible_navigation_entry;

Returns the current visible navigation entry for this browser. This function can only be called on the UI thread.

get_window_handle
c_ulong function(cef_browser_host_t* self) nothrow get_window_handle;

Retrieve the window handle (if any) for this browser. If this browser is wrapped in a cef_browser_view_t this function should be called on the browser process UI thread and it will return the handle for the top-level native window.

get_windowless_frame_rate
int function(cef_browser_host_t* self) nothrow get_windowless_frame_rate;

Returns the maximum rate in frames per second (fps) that

get_zoom_level
double function(cef_browser_host_t* self) nothrow get_zoom_level;

Get the current zoom level. This function can only be called on the UI thread.

has_dev_tools
int function(cef_browser_host_t* self) nothrow has_dev_tools;

Returns true (1) if this browser currently has an associated DevTools browser. Must be called on the browser process UI thread.

has_view
int function(cef_browser_host_t* self) nothrow has_view;

Returns true (1) if this browser is wrapped in a cef_browser_view_t.

ime_cancel_composition
void function(cef_browser_host_t* self) nothrow ime_cancel_composition;

Cancels the existing composition and discards the composition node contents without applying them. See comments on ImeSetComposition for usage. This function is only used when window rendering is disabled.

ime_commit_text
void function(cef_browser_host_t* self, const(cef_string_t)* text, const(cef_range_t)* replacement_range, int relative_cursor_pos) nothrow ime_commit_text;

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 function is only used when window rendering is disabled.

ime_finish_composing_text
void function(cef_browser_host_t* self, int keep_selection) nothrow ime_finish_composing_text;

Completes the existing composition by applying the current composition node contents. If |keep_selection| is false (0) the current selection, if any, will be discarded. See comments on ImeSetComposition for usage. This function is only used when window rendering is disabled.

ime_set_composition
void function(cef_browser_host_t* self, const(cef_string_t)* text, size_t underlinesCount, const(cef_composition_underline_t)* underlines, const(cef_range_t)* replacement_range, const(cef_range_t)* selection_range) nothrow ime_set_composition;

Begins a new composition or updates the existing composition. Blink has a special node (a composition node) that allows the input function 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.

invalidate
void function(cef_browser_host_t* self, cef_paint_element_type_t type) nothrow invalidate;

Invalidate the view. The browser will call cef_render_handler_t::OnPaint asynchronously. This function is only used when window rendering is disabled.

is_audio_muted
int function(cef_browser_host_t* self) nothrow is_audio_muted;

Returns true (1) if the browser's audio is muted. This function can only be called on the UI thread.

is_background_host
int function(cef_browser_host_t* self) nothrow is_background_host;

Returns true (1) if this browser is hosting an extension background script. Background hosts do not have a window and are not displayable. See

is_fullscreen
int function(cef_browser_host_t* self) nothrow is_fullscreen;

Returns true (1) 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-structure. This function can only be called on the UI thread.

is_render_process_unresponsive
int function(cef_browser_host_t* self) nothrow is_render_process_unresponsive;

Returns true (1) 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

is_window_rendering_disabled
int function(cef_browser_host_t* self) nothrow is_window_rendering_disabled;

Returns true (1) if window rendering is disabled.

notify_move_or_resize_started
void function(cef_browser_host_t* self) nothrow notify_move_or_resize_started;

Notify the browser that the window hosting it is about to be moved or resized. This function is only used on Windows and Linux.

notify_screen_info_changed
void function(cef_browser_host_t* self) nothrow notify_screen_info_changed;

Send a notification to the browser that the screen info has changed. The browser will then call cef_render_handler_t::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 function is only used when window rendering is disabled.

print
void function(cef_browser_host_t* self) nothrow print;

Print the current browser contents.

print_to_pdf
void function(cef_browser_host_t* self, const(cef_string_t)* path, const(cef_pdf_print_settings_t)* settings, cef_pdf_print_callback_t* callback) nothrow print_to_pdf;

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

replace_misspelling
void function(cef_browser_host_t* self, const(cef_string_t)* word) nothrow replace_misspelling;

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

run_file_dialog
void function(cef_browser_host_t* self, cef_file_dialog_mode_t mode, const(cef_string_t)* title, const(cef_string_t)* default_file_path, cef_string_list_t accept_filters, cef_run_file_dialog_callback_t* callback) nothrow run_file_dialog;

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 NULL 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.

send_capture_lost_event
void function(cef_browser_host_t* self) nothrow send_capture_lost_event;

Send a capture lost event to the browser.

send_dev_tools_message
int function(cef_browser_host_t* self, const(void)* message, size_t message_size) nothrow send_dev_tools_message;

Send a function call message over the DevTools protocol. |message| must be a UTF8-encoded JSON dictionary that contains "id" (int), "function" (string) and "params" (dictionary, optional) values. See the DevTools protocol documentation at https://chromedevtools.github.io/devtools- protocol/ for details of supported functions and the expected "params" dictionary contents. |message| will be copied if necessary. This function will return true (1) if called on the UI thread and the message was successfully submitted for validation, otherwise false (0). 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.

send_external_begin_frame
void function(cef_browser_host_t* self) nothrow send_external_begin_frame;

Issue a BeginFrame request to Chromium. Only valid when

send_key_event
void function(cef_browser_host_t* self, const(cef_key_event_t)* event) nothrow send_key_event;

Send a key event to the browser.

send_mouse_click_event
void function(cef_browser_host_t* self, const(cef_mouse_event_t)* event, cef_mouse_button_type_t type, int mouseUp, int clickCount) nothrow send_mouse_click_event;

Send a mouse click event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view.

send_mouse_move_event
void function(cef_browser_host_t* self, const(cef_mouse_event_t)* event, int mouseLeave) nothrow send_mouse_move_event;

Send a mouse move event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view.

send_mouse_wheel_event
void function(cef_browser_host_t* self, const(cef_mouse_event_t)* event, int deltaX, int deltaY) nothrow send_mouse_wheel_event;

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 cef_render_handler_t::GetScreenPoint should be implemented properly.

send_touch_event
void function(cef_browser_host_t* self, const(cef_touch_event_t)* event) nothrow send_touch_event;

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

set_accessibility_state
void function(cef_browser_host_t* self, cef_state_t accessibility_state) nothrow set_accessibility_state;

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.

set_audio_muted
void function(cef_browser_host_t* self, int mute) nothrow set_audio_muted;

Set whether the browser's audio is muted.

set_auto_resize_enabled
void function(cef_browser_host_t* self, int enabled, const(cef_size_t)* min_size, const(cef_size_t)* max_size) nothrow set_auto_resize_enabled;

Enable notifications of auto resize via

set_focus
void function(cef_browser_host_t* self, int focus) nothrow set_focus;

Set whether the browser is focused.

set_windowless_frame_rate
void function(cef_browser_host_t* self, int frame_rate) nothrow set_windowless_frame_rate;

Set the maximum rate in frames per second (fps) that

set_zoom_level
void function(cef_browser_host_t* self, double zoomLevel) nothrow set_zoom_level;

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.

show_dev_tools
void function(cef_browser_host_t* self, const(cef_window_info_t)* windowInfo, cef_client_t* client, const(cef_browser_settings_t)* settings, const(cef_point_t)* inspect_element_at) nothrow show_dev_tools;

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-NULL 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 cef_browser_view_t.

start_download
void function(cef_browser_host_t* self, const(cef_string_t)* url) nothrow start_download;

Download the file at |url| using cef_download_handler_t.

stop_finding
void function(cef_browser_host_t* self, int clearSelection) nothrow stop_finding;

Cancel all searches that are currently going on.

try_close_browser
int function(cef_browser_host_t* self) nothrow try_close_browser;

Helper for closing a browser. Call this function from the top-level window close handler (if any). Internally this calls CloseBrowser(false (0)) if the close has not yet been initiated. This function returns false (0) while the close is pending and true (1) after the close has completed. See close_browser() and cef_life_span_handler_t::do_close() documentation for additional usage information. This function must be called on the browser process UI thread.

was_hidden
void function(cef_browser_host_t* self, int hidden) nothrow was_hidden;

Notify the browser that it has been hidden or shown. Layouting and

was_resized
void function(cef_browser_host_t* self) nothrow was_resized;

Notify the browser that the widget has been resized. The browser will first call cef_render_handler_t::GetViewRect to get the new size and then call cef_render_handler_t::OnPaint asynchronously with the updated regions. This function is only used when window rendering is disabled.

zoom
void function(cef_browser_host_t* self, cef_zoom_command_t command) nothrow zoom;

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.

Meta