# Class TChromiumWindow

Description
Hierarchy
Fields
Methods
Properties

## Unit

uCEFChromiumWindow

## Declaration

`type TChromiumWindow = class(TCEFLinkedWinControlBase)`

## Description

This component puts together a TChromium and a TCEFWindowParent to embbed a web browser with only one component.

This component should only be used in extremely simple applications with simple browsers. In other cases it's recomended using a TChromium with a TCEFWindowParent as shown in the SimpleBrowser2 demo.

## Hierarchy

- TWinControl
- TCEFWinControl
- TCEFLinkedWinControlBase
- TChromiumWindow

## Overview

### Fields

| `FChromium: TChromium;`
| `FOnClose: TNotifyEvent;`
| `FOnBeforeClose: TNotifyEvent;`
| `FOnAfterCreated: TNotifyEvent;`

### Methods

| `function GetChromium: TChromium; override;`
| `function GetBrowserInitialized: boolean;`
| `procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE;`
| `procedure OnAfterCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;`
| `procedure WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);`
| `procedure WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);`
| `procedure WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser);`
| `procedure WebBrowser_OnGotFocus(Sender: TObject; const browser: ICefBrowser);`
| `procedure BrowserSetFocusMsg(Data: PtrInt);`
| `procedure BrowserAfterCreated(Data: PtrInt);`
| `procedure BrowserOnCLose(Data: PtrInt);`
| `procedure DoEnter; override;`
| `procedure DoExit; override;`
| `constructor Create(AOwner: TComponent); override;`
| `procedure AfterConstruction; override;`
| `function CreateBrowser: boolean;`
| `procedure CloseBrowser(aForceClose : boolean);`
| `procedure LoadURL(const aURL : ustring);`
| `procedure NotifyMoveOrResizeStarted;`

### Properties

| `property ChromiumBrowser : TChromium read GetChromium;`
| `property Initialized : boolean read GetBrowserInitialized;`
| `property OnClose : TNotifyEvent read FOnClose write FOnClose;`
| `property OnBeforeClose : TNotifyEvent read FOnBeforeClose write FOnBeforeClose;`
| `property OnAfterCreated : TNotifyEvent read FOnAfterCreated write FOnAfterCreated;`

## Description

### Fields

| `FChromium: TChromium;`
This item has no description.

| `FOnClose: TNotifyEvent;`
This item has no description.

| `FOnBeforeClose: TNotifyEvent;`
This item has no description.

| `FOnAfterCreated: TNotifyEvent;`
This item has no description.

### Methods

| `function GetChromium: TChromium; override;`
This item has no description.

| `function GetBrowserInitialized: boolean;`
This item has no description.

| `procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE;`
This item has no description.

| `procedure OnAfterCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;`
This item has no description.

| `procedure WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);`
This item has no description.

| `procedure WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);`
This item has no description.

| `procedure WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser);`
This item has no description.

| `procedure WebBrowser_OnGotFocus(Sender: TObject; const browser: ICefBrowser);`
This item has no description.

| `procedure BrowserSetFocusMsg(Data: PtrInt);`
This item has no description.

| `procedure BrowserAfterCreated(Data: PtrInt);`
This item has no description.

| `procedure BrowserOnCLose(Data: PtrInt);`
This item has no description.

| `procedure DoEnter; override;`
This item has no description.

| `procedure DoExit; override;`
This item has no description.

| `constructor Create(AOwner: TComponent); override;`
This item has no description.

| `procedure AfterConstruction; override;`
This item has no description.

| `function CreateBrowser: boolean;`
Used to create the browser after the global request context has been initialized. You need to set all properties and events before calling this function because it will only create the internal handlers needed for those events and the property values will be used in the browser initialization. The browser will be fully initialized when the TChromiumWindow.OnAfterCreated event is triggered.

| `procedure CloseBrowser(aForceClose : boolean);`
Request that the browser close. The JavaScript 'onbeforeunload' event will be fired. If |aForceClose| is false (0) the event handler, if any, will be allowed to prompt the user and the user can optionally cancel the close. If |aForceClose| is true (1) the prompt will not be displayed and the close will proceed. Results in a call to ICefLifeSpanHandler.DoClose() if the event handler allows the close or if |aForceClose| is true (1). See ICefLifeSpanHandler.DoClose() documentation for additional usage information.

| `procedure LoadURL(const aURL : ustring);`
Used to navigate to a URL.

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

### Properties

| `property ChromiumBrowser : TChromium read GetChromium;`
TChromium instance used by this component.

| `property Initialized : boolean read GetBrowserInitialized;`
Returns true when the browser is fully initialized and it's not being closed.

| `property OnClose : TNotifyEvent read FOnClose write FOnClose;`
Called when a browser has recieved a request to close. This may result directly from a call to ICefBrowserHost.*CloseBrowser or indirectly if the browser is parented to a top-level window created by CEF and the user attempts to close that window (by clicking the 'X', for example). The OnClose function will be called after the JavaScript 'onunload' event has been fired. An application should handle top-level owner window close notifications by calling ICefBrowserHost.TryCloseBrowser or ICefBrowserHost.CloseBrowser(false) instead of allowing the window to close immediately (see the examples below). This gives CEF an opportunity to process the 'onbeforeunload' event and optionally cancel the close before OnClose is called. When windowed rendering is enabled CEF will internally create a window or view to host the browser. In that case returning false (0) from OnClose() will send the standard close notification to the browser's top-level owner window (e.g. WM_CLOSE on Windows, performClose: on OS X, "delete_event" on Linux or ICefWindowDelegate.CanClose callback from Views). If the browser's host window/view has already been destroyed (via view hierarchy tear-down, for example) then OnClose() will not be called for that browser since is no longer possible to cancel the close. When windowed rendering is disabled returning false (0) from OnClose() will cause the browser object to be destroyed immediately. If the browser's top-level owner window requires a non-standard close notification then send that notification from OnClose() and return true. The ICefLifeSpanHandler.OnBeforeClose function will be called after OnClose() (if OnClose() is called) and immediately before the browser object is destroyed. The application should only exit after OnBeforeClose() has been called for all existing browsers. The below examples describe what should happen during window close when the browser is parented to an application-provided top-level window. Example 1: Using ICefBrowserHost.TryCloseBrowser(). This is recommended for clients using standard close handling and windows created on the browser process UI thread.
    1.  User clicks the window close button which sends a close notification
        to the application's top-level window.
    2.  Application's top-level window receives the close notification and
        calls TryCloseBrowser() (which internally calls CloseBrowser(false)).
        TryCloseBrowser() returns false so the client cancels the window
        close.
    3.  JavaScript 'onbeforeunload' handler executes and shows the close
        confirmation dialog (which can be overridden via
        ICefJSDialogHandler.OnBeforeUnloadDialog()).
    4.  User approves the close.
    5.  JavaScript 'onunload' handler executes.
    6.  CEF sends a close notification to the application's top-level window
        (because OnClose() returned false by default).
    7.  Application's top-level window receives the close notification and
        calls TryCloseBrowser(). TryCloseBrowser() returns true so the client
        allows the window close.
    8.  Application's top-level window is destroyed.
    9.  Application's OnBeforeClose() handler is called and the browser object is destroyed.
    10. Application exits by calling cef_quit_message_loop() if no other browsers exist.
Example 2: Using ICefBrowserHost::CloseBrowser(false) and implementing the OnClose() callback. This is recommended for clients using non-standard close handling or windows that were not created on the browser process UI thread.
    1.  User clicks the window close button which sends a close notification
        to the application's top-level window.
    2.  Application's top-level window receives the close notification and:
        A. Calls ICefBrowserHost.CloseBrowser(false).
        B. Cancels the window close.
    3.  JavaScript 'onbeforeunload' handler executes and shows the close
        confirmation dialog (which can be overridden via
        ICefJSDialogHandler.OnBeforeUnloadDialog()).
    4.  User approves the close.
    5.  JavaScript 'onunload' handler executes.
    6.  Application's OnClose() handler is called. Application will:
        A. Set a flag to indicate that the next close attempt will be allowed.
        B. Return false.
    7.  CEF sends an close notification to the application's top-level window.
    8.  Application's top-level window receives the close notification and
        allows the window to close based on the flag from #6B.
    9.  Application's top-level window is destroyed.
    10. Application's OnBeforeClose() handler is called and the browser object is destroyed.
    11. Application exits by calling cef_quit_message_loop() if no other browsers exist.
This event will be called on the main application thread. <see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_life_span_handler_capi.h">CEF source file: /include/capi/cef_life_span_handler_capi.h (cef_life_span_handler_t))

| `property OnBeforeClose : TNotifyEvent read FOnBeforeClose write FOnBeforeClose;`
Called just before a browser is destroyed. Release all references to the browser object and do not attempt to execute any functions on the browser object (other than IsValid, GetIdentifier or IsSame) after this callback returns. ICefFrameHandler callbacks related to final main frame destruction will arrive after this callback and ICefBrowser.IsValid will return false (0) at that time. Any in-progress network requests associated with |browser| will be aborted when the browser is destroyed, and ICefResourceRequestHandler callbacks related to those requests may still arrive on the IO thread after this callback. See ICefFrameHandler and OnClose() documentation for additional usage information. This event will be called on the browser process CEF UI thread. <see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_life_span_handler_capi.h">CEF source file: /include/capi/cef_life_span_handler_capi.h (cef_life_span_handler_t))

| `property OnAfterCreated : TNotifyEvent read FOnAfterCreated write FOnAfterCreated;`
Called after a new browser is created. It is now safe to begin performing actions with |browser|. ICefFrameHandler callbacks related to initial main frame creation will arrive before this callback. See ICefFrameHandler documentation for additional usage information. This event will be called on the main application thread. <see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_life_span_handler_capi.h">CEF source file: /include/capi/cef_life_span_handler_capi.h (cef_life_span_handler_t))

Generated by PasDoc 0.16.0-snapshot.