Click or drag to resize
CfxBrowserHost Class

[This is preliminary documentation and is subject to change.]

Structure used to represent the browser process aspects of a browser window. 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.
Inheritance Hierarchy
SystemObject
  ChromiumCfxObject
    ChromiumCfxBase
      ChromiumCfxLibraryBase
        ChromiumCfxBrowserHost

Namespace: Chromium
Assembly: ChromiumFX (in ChromiumFX.dll)
Syntax
public class CfxBrowserHost : CfxLibraryBase

The CfxBrowserHost type exposes the following members.

Properties
  NameDescription
Public propertyBrowser
Returns the hosted browser object.
Public propertyClient
Returns the client for this browser.
Public propertyHasDevTools
Returns true (1) if this browser currently has an associated DevTools browser. Must be called on the browser process UI thread.
Public propertyHasView
Returns true (1) if this browser is wrapped in a CfxBrowserView.
Public propertyIsMouseCursorChangeDisabled
Returns true (1) if mouse cursor change is disabled.
Public propertyIsWindowRenderingDisabled
Returns true (1) if window rendering is disabled.
Public propertyNativePtr
Provides access to the underlying native cef struct. This is a refcounted library struct derived from cef_base_t. Add a ref in order to keep it alive when this managed object go out of scope.
(Inherited from CfxLibraryBase.)
Public propertyOpenerWindowHandle
Retrieve the window handle of the browser that opened this browser. Will return NULL for non-popup windows or if this browser is wrapped in a CfxBrowserView. This function can be used in combination with custom handling of modal windows.
Public propertyRequestContext
Returns the request context for this browser.
Public propertyVisibleNavigationEntry
Returns the current visible navigation entry for this browser. This function can only be called on the UI thread.
Public propertyWindowHandle
Retrieve the window handle for this browser. If this browser is wrapped in a CfxBrowserView this function should be called on the browser process UI thread and it will return the handle for the top-level native window.
Public propertyWindowlessFrameRate
Returns the maximum rate in frames per second (fps) that CfxRenderHandler:: 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 function can only be called on the UI thread. Set the maximum rate in frames per second (fps) that CfxRenderHandler:: 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 CfxBrowserSettings.WindowlessFrameRate.
Public propertyZoomLevel
Get the current zoom level. The default zoom level is 0.0. This function can only be called on the UI thread. Change the zoom level to the specified value. Specify 0.0 to reset the zoom level. If called on the UI thread the change will be applied immediately. Otherwise, the change will be applied asynchronously on the UI thread.
Top
Methods
  NameDescription
Public methodAddWordToDictionary
Add the specified |word| to the spelling dictionary.
Public methodCloseBrowser
Request that the browser close. The JavaScript 'onbeforeunload' event will be fired. If |forceClose| is false (0) the event handler, if any, will be allowed to prompt the user and the user can optionally cancel the close. If |forceClose| is true (1) the prompt will not be displayed and the close will proceed. Results in a call to CfxLifeSpanHandler.DoClose() if the event handler allows the close or if |forceClose| is true (1). See CfxLifeSpanHandler.DoClose() documentation for additional usage information.
Public methodCloseDevTools
Explicitly close the associated DevTools browser, if any.
Public methodStatic memberCreateBrowser
Create a new browser window using the window parameters specified by |windowInfo|. All values will be copied internally and the actual window will be created on the UI thread. If |requestContext| is NULL the global request context will be used. This function can be called on any browser process thread and will not block.
Public methodStatic memberCreateBrowserSync
Create a new browser window using the window parameters specified by |windowInfo|. If |requestContext| is NULL the global request context will be used. This function can only be called on the browser process UI thread.
Public methodDownloadImage
Download |imageUrl| and execute |callback| on completion with the images received from the renderer. If |isFavicon| is true (1) then cookies are not sent and not accepted during download. Images with density independent pixel (DIP) sizes larger than |maxImageSize| 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 <= |maxImageSize| then the smallest image is resized to |maxImageSize| and is the only result. A |maxImageSize| of 0 means unlimited. If |bypassCache| is true (1) then |imageUrl| is requested from the server even if it is present in the browser cache.
Public methodDragSourceEndedAt
Call this function when the drag operation started by a CfxRenderHandler.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* functions should be called before DragSource* mthods. This function is only used when window rendering is disabled.
Public methodDragSourceSystemDragEnded
Call this function when the drag operation started by a CfxRenderHandler.StartDragging call has completed. This function 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* functions should be called before DragSource* mthods. This function is only used when window rendering is disabled.
Public methodDragTargetDragEnter
Call this function when the user drags the mouse into the web view (before calling DragTargetDragOver/DragTargetLeave/DragTargetDrop). |dragData| 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 CfxDragData.ResetFileContents (for example, if |dragData| comes from CfxRenderHandler.StartDragging). This function is only used when window rendering is disabled.
Public methodDragTargetDragLeave
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.
Public methodDragTargetDragOver
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.
Public methodDragTargetDrop
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 |dragData|, given as an argument to the previous DragTargetDragEnter call. This function is only used when window rendering is disabled.
Public methodFind
Search for |searchText|. |identifier| can be used to have multiple searches running simultaniously. |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 CfxFindHandler instance, if any, returned via CfxClient.GetFindHandler will be called to report find results.
Public methodGetNavigationEntries
Retrieve a snapshot of current navigation entries as values sent to the specified visitor. If |currentOnly| is true (1) only the current navigation entry will be sent, otherwise all navigation entries will be sent.
Public methodImeCancelComposition
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.
Public methodImeCommitText
Completes the existing composition by optionally inserting the specified |text| into the composition node. |replacementRange| is an optional range of the existing text that will be replaced. |relativeCursorPos| is where the cursor will be positioned relative to the current cursor position. See comments on ImeSetComposition for usage. The |replacementRange| and |relativeCursorPos| values are only used on OS X. This function is only used when window rendering is disabled.
Public methodImeFinishComposingText
Completes the existing composition by applying the current composition node contents. If |keepSelection| 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.
Public methodImeSetComposition
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. |replacementRange| is an optional range of the existing text that will be replaced. |selectionRange| is an optional range of the resulting text that will be selected after insertion or replacement. The |replacementRange| value is only used on OS X. This function 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: A. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR flag (on Windows), or; B. The client receives a "commit" signal of GtkIMContext (on Linux), or; C. insertText of NSTextInput is called (on Mac). This function is only used when window rendering is disabled.
Public methodInvalidate
Invalidate the view. The browser will call CfxRenderHandler.OnPaint asynchronously. This function is only used when window rendering is disabled.
Public methodNotifyMoveOrResizeStarted
Notify the browser that the window hosting it is about to be moved or resized. This function is only used on Windows and Linux.
Public methodNotifyScreenInfoChanged
Send a notification to the browser that the screen info has changed. The browser will then call CfxRenderHandler.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.
Public methodPrint
Print the current browser contents.
Public methodPrintToPdf
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 CfxPrintHandler.GetPdfPaperSize function.
Public methodReplaceMisspelling
If a misspelled word is currently selected in an editable node calling this function will replace it with the specified |word|.
Public methodRunFileDialog
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). |defaultFilePath| is the path with optional directory and/or file name component that will be initially selected in the dialog. |acceptFilters| 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"). |selectedAcceptFilter| is the 0-based index of the filter that will be selected by default. |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.
Public methodSendCaptureLostEvent
Send a capture lost event to the browser.
Public methodSendFocusEvent
Send a focus event to the browser.
Public methodSendKeyEvent
Send a key event to the browser.
Public methodSendMouseClickEvent
Send a mouse click event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view.
Public methodSendMouseMoveEvent
Send a mouse move event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view.
Public methodSendMouseWheelEvent
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 CfxRenderHandler.GetScreenPoint should be implemented properly.
Public methodSetFocus
Set whether the browser is focused.
Public methodSetMouseCursorChangeDisabled
Set whether mouse cursor change is disabled.
Public methodShowDevTools
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 |inspectElementAt| 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 CfxBrowserView.
Public methodStartDownload
Download the file at |url| using CfxDownloadHandler.
Public methodStopFinding
Cancel all searches that are currently going on.
Public methodTryCloseBrowser
Helper for closing a browser. Call this function from the top-level window close handler. 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 CfxLifeSpanHandler.DoClose() documentation for additional usage information. This function must be called on the browser process UI thread.
Public methodWasHidden
Notify the browser that it has been hidden or shown. Layouting and CfxRenderHandler.OnPaint notification will stop when the browser is hidden. This function is only used when window rendering is disabled.
Public methodWasResized
Notify the browser that the widget has been resized. The browser will first call CfxRenderHandler.GetViewRect to get the new size and then call CfxRenderHandler.OnPaint asynchronously with the updated regions. This function is only used when window rendering is disabled.
Top
Remarks
See also the original CEF documentation in cef/include/capi/cef_browser_capi.h.
See Also