Struct
BrowserHandle
pub struct BrowserHandle { /* private fields */ }A browser of the running application.
The handle names the browser by its BrowserId and looks it up on each
call. Once the browser has closed, or once AppInstance::shutdown has
begun, the calls that would reach it do nothing and its queries answer
false, or an empty URL.
Threads
Usable from any thread, as CEF allows for a browser in the browser
process. set_bounds and
has_devtools are the exceptions. They run only on
the thread that started the application (CEF’s UI thread) and panic
elsewhere.
Methods
#pub fn close(&self, force: bool)
Closes the browser.
With force false the page’s unload handlers run first and may cancel
the close. The call does not wait. The browser is gone once CEF has
finished closing it. A browser embedded in the application’s own
window closes without asking that window to close.
#pub fn set_bounds(&self, bounds: BrowserBounds)
Moves and resizes a browser made by
AppInstance::create_child_browser inside its parent window.
bounds are in the parent’s coordinates, as at creation (see
BrowserBounds); a width or height below one counts as one. On
Windows and Linux Chromium places such a browser once and does not
follow its parent. The application calls this whenever the browser’s
place changes (on every resize for a browser that fills its window).
On macOS the browser stretches with its parent by itself and this
places it anywhere.
Does nothing for any other browser and nothing once the browser has closed.
Panics
Off the thread that started the application (CEF’s UI thread). The browser’s native window is moved only there.
#pub fn notify_move_or_resize_started(&self)
Tells the browser that the window hosting it is about to move or resize. CEF uses this on Windows and Linux only.
#pub fn reload(&self)
Reload the current page.
#pub fn reload_ignore_cache(&self)
Reload the current page, ignoring cached content.
#pub fn go_back(&self)
Navigate back in history, if possible.
#pub fn go_forward(&self)
Navigate forward in history, if possible.
#pub fn can_go_back(&self) -> bool
Returns true if the browser can go back.
#pub fn can_go_forward(&self) -> bool
Returns true if the browser can go forward.
#pub fn is_loading(&self) -> bool
Returns true if the browser is currently loading.
#pub fn execute_javascript(&self, code: &str, script_url: &str, start_line: i32)
Execute JavaScript in the main frame.
#pub fn show_devtools(&self)
Open DevTools for this browser.
#pub fn close_devtools(&self)
Close DevTools if open.
#pub fn has_devtools(&self) -> bool
Returns true if DevTools is currently open for this browser.
Panics
Off the thread that started the application (CEF’s UI thread). CEF answers this only there.
Trait implementations
impl Debug for BrowserHandle