CefSharp.WinForms
Initialization settings. Many of these and other settings can also configured
using command-line switches.
ChromiumWebBrowser Control Designer
Receives a call when the control that the designer is managing has painted its surface so the designer can paint any additional adornments on top of the control.
args
Adjusts the set of properties the component exposes through a TypeDescriptor.
properties
Default implementation of
for the WinForms implementation
Called when the browser component has received focus.
the ChromiumWebBrowser control
the browser object
Try to avoid needing to override this logic in a subclass. The implementation in
DefaultFocusHandler relies on very detailed behavior of how WinForms and
Windows interact during window activation.
Called when the browser component is requesting focus.
the ChromiumWebBrowser control
the browser object
Indicates where the focus request is originating from.
Return false to allow the focus to be set or true to cancel setting the focus.
Called when the browser component is about to lose focus.
For instance, if focus was on the last HTML element and the user pressed the TAB key.
the ChromiumWebBrowser control
the browser object
Will be true if the browser is giving focus to the next component
and false if the browser is giving focus to the previous component.
ControlExtensions.
Executes the Action asynchronously on the UI thread, does not block execution on the calling thread.
the control for which the update is required
action to be performed on the control
Activates the specified control.
The control.
true if XXXX, false otherwise.
Returns whether the supplied control is the currently
active control.
the control to check
true if the control is the currently active control
Selects the next control.
The control.
if set to true [next].
ParentFormMessageInterceptor - hooks into the parent forms
message loop to incercept messages like WM_MOVE
Keep track of whether a move is in progress.
Used to determine the coordinates involved in the move
Gets or sets the browser.
The browser.
Gets or sets the parent form.
The parent form.
Initializes a new instance of the class.
The browser.
Call to force refinding of the parent Form.
(i.e. top level window that owns the ChromiumWebBrowserControl)
Adjust the form to listen to if the ChromiumWebBrowserControl's parent changes.
The ChromiumWebBrowser whose parent has changed.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
Invokes the default window procedure associated with this window.
A that is associated with the current Windows message.
Called when [moving].
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Releases unmanaged and - optionally - managed resources.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
When overridden in a derived class, manages an unhandled thread exception.
An that specifies the unhandled thread exception.
Class NativeMethods.
The w m_ move
The w m_ moving
The w m_ activate
WinForms specific implementation, has events the
implementation exposes.
Occurs when the browser title changed.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Occurs when the browser address changed.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
ChromiumWebBrowser is the WinForms web browser control
The managed cef browser adapter
The parent form message interceptor
The browser
A flag that indicates whether or not the designer is active
NOTE: DesignMode becomes false by the time we get to the destructor/dispose so it gets stored here
A flag that indicates whether or not has been called.
Has the underlying Cef Browser been created (slightly different to initliazed in that
the browser is initialized in an async fashion)
Browser initialization settings
The request context (we deliberately use a private variable so we can throw an exception if
user attempts to set after browser created)
Set to true while handing an activating WM_ACTIVATE message.
MUST ONLY be cleared by DefaultFocusHandler.
true if this instance is activating; otherwise, false.
Gets or sets the browser settings.
The browser settings.
Gets or sets the request context.
The request context.
A flag that indicates whether the control is currently loading one or more web pages (true) or not (false).
true if this instance is loading; otherwise, false.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
The text that will be displayed as a ToolTip
The tooltip text.
The address (URL) which the browser control is currently displaying.
Will automatically be updated as the user navigates to another page (e.g. by clicking on a link).
The address.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
Implement and assign to handle dialog events.
The dialog handler.
Implement and assign to handle events related to JavaScript Dialogs.
The js dialog handler.
Implement and assign to handle events related to key press.
The keyboard handler.
Implement and assign to handle events related to browser requests.
The request handler.
Implement and assign to handle events related to downloading files.
The download handler.
Implement and assign to handle events related to browser load status.
The load handler.
Implement and assign to handle events related to popups.
The life span handler.
Implement and assign to handle events related to browser display state.
The display handler.
Implement and assign to handle events related to the browser context menu
The menu handler.
Implement and assign to handle messages from the render process.
The render process message handler.
Implement to handle events related to find results.
The find handler.
The for this ChromiumWebBrowser.
The focus handler.
If you need customized focus handling behavior for WinForms, the suggested
best practice would be to inherit from DefaultFocusHandler and try to avoid
needing to override the logic in OnGotFocus. The implementation in
DefaultFocusHandler relies on very detailed behavior of how WinForms and
Windows interact during window activation.
Implement and assign to handle events related to dragging.
The drag handler.
Implement and control the loading of resources
The resource handler factory.
Event handler that will get called when the resource load for a navigation fails or is canceled.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Event handler that will get called when the browser begins loading a frame. Multiple frames may be loading at the same
time. Sub-frames may start or continue loading after the main frame load has ended. This method may not be called for a
particular frame if the load request for that frame fails. For notification of overall browser load status use
OnLoadingStateChange instead.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Whilst this may seem like a logical place to execute js, it's called before the DOM has been loaded, implement
as it's called when the underlying V8Context is created
Event handler that will get called when the browser is done loading a frame. Multiple frames may be loading at the same
time. Sub-frames may start or continue loading after the main frame load has ended. This method will always be called
for all frames irrespective of whether the request completes successfully.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Event handler that will get called when the Loading state has changed.
This event will be fired twice. Once when loading is initiated either programmatically or
by user action, and once when loading is terminated due to completion, cancellation of failure.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Event handler for receiving Javascript console messages being sent from web pages.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
(The exception to this is when your running with settings.MultiThreadedMessageLoop = false, then they'll be the same thread).
Event handler for changes to the status message.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang.
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
(The exception to this is when your running with settings.MultiThreadedMessageLoop = false, then they'll be the same thread).
Occurs when the browser address changed.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Occurs when the browser title changed.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Event called after the underlying CEF browser instance has been created.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
A flag that indicates whether the state of the control currently supports the GoForward action (true) or not (false).
true if this instance can go forward; otherwise, false.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
A flag that indicates whether the state of the control current supports the GoBack action (true) or not (false).
true if this instance can go back; otherwise, false.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
A flag that indicates whether the WebBrowser is initialized (true) or not (false).
true if this instance is browser initialized; otherwise, false.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
A flag that indicates if you can execute javascript in the main frame.
Flag is set to true in IRenderProcessMessageHandler.OnContextCreated.
and false in IRenderProcessMessageHandler.OnContextReleased
ParentFormMessageInterceptor hooks the Form handle and forwards
the move/active messages to the browser, the default is true
and should only be required when using
set to true.
Initializes static members of the class.
Handles the event.
The sender.
The instance containing the event data.
This constructor exists as the WinForms designer requires a parameterless constructor, if you are instantiating
an instance of this class in code then use the
constructor overload instead. Using this constructor in code is unsupported and you may experience 's
when attempting to access some of the properties immediately after instantiation.
Initializes a new instance of the class.
The address.
Request context that will be used for this browser instance,
if null the Global Request Context will be used
Required for designer support - this method cannot be inlined as the designer
will attempt to load libcef.dll and will subsiquently throw an exception.
TODO: Still not happy with this method name, need something better
Releases the unmanaged resources used by the and its child controls and optionally releases the managed resources.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Required for designer support - this method cannot be inlined as the designer
will attempt to load libcef.dll and will subsiquently throw an exception.
Required for designer support - this method cannot be inlined as the designer
will attempt to load libcef.dll and will subsiquently throw an exception.
Loads the specified URL.
The URL to be loaded.
Registers a Javascript object in this specific browser instance.
The name of the object. (e.g. "foo", if you want the object to be accessible as window.foo).
The object to be made accessible to Javascript.
binding options - camelCaseJavascriptNames default to true
Browser is already initialized. RegisterJsObject must be +
called before the underlying CEF browser is created.
Asynchronously registers a Javascript object in this specific browser instance.
Only methods of the object will be availabe.
The name of the object. (e.g. "foo", if you want the object to be accessible as window.foo).
The object to be made accessible to Javascript.
binding options - camelCaseJavascriptNames default to true
Browser is already initialized. RegisterJsObject must be +
called before the underlying CEF browser is created.
The registered methods can only be called in an async way, they will all return immeditaly and the resulting
object will be a standard javascript Promise object which is usable to wait for completion or failure.
The javascript object repository, one repository per ChromiumWebBrowser instance.
Raises the event.
An that contains the event data.
Called after browser created.
The browser.
Sets the address.
The instance containing the event data.
Sets the loading state change.
The instance containing the event data.
Sets the title.
The instance containing the event data.
Sets the tooltip text.
The tooltip text.
Handles the event.
The instance containing the event data.
Handles the event.
The instance containing the event data.
Handles the event.
The instance containing the event data.
Handles the event.
The instance containing the event data.
Handles the event.
The instance containing the event data.
Gets the browser adapter.
The browser adapter.
Gets or sets a value indicating whether this instance has parent.
true if this instance has parent; otherwise, false.
Manually implement Focused because cef does not implement it.
true if focused; otherwise, false.
This is also how the Microsoft's WebBrowserControl implements the Focused property.
Raises the event.
An that contains the event data.
Resizes the browser.
Raises the event.
An that contains the event data.
Returns the current IBrowser Instance
browser instance or null
Makes certain keys as Input keys when CefSettings.MultiThreadedMessageLoop = false
key data
true for a select list of keys otherwise defers to base.IsInputKey