diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index 912be7b9..ae083c0a 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -1018,9 +1018,44 @@ type /// ICefFrameHandler = interface(ICefBaseRefCounted) ['{B437128C-F7CB-4F75-83CF-A257B98C0B6E}'] + /// + /// Called when a new frame is created. This will be the first notification + /// that references |frame|. Any commands that require transport to the + /// associated renderer process (LoadRequest, SendProcessMessage, GetSource, + /// etc.) will be queued until OnFrameAttached is called for |frame|. + /// procedure OnFrameCreated(const browser: ICefBrowser; const frame: ICefFrame); + /// + /// Called when a frame can begin routing commands to/from the associated + /// renderer process. |reattached| will be true (1) if the frame was re- + /// attached after exiting the BackForwardCache. Any commands that were queued + /// have now been dispatched. + /// procedure OnFrameAttached(const browser: ICefBrowser; const frame: ICefFrame; reattached: boolean); + /// + /// Called when a frame loses its connection to the renderer process and will + /// be destroyed. Any pending or future commands will be discarded and + /// cef_frame_t::is_valid() will now return false (0) for |frame|. If called + /// after cef_life_span_handler_t::on_before_close() during browser + /// destruction then cef_browser_t::is_valid() will return false (0) for + /// |browser|. + /// procedure OnFrameDetached(const browser: ICefBrowser; const frame: ICefFrame); + /// + /// Called when the main frame changes due to (a) initial browser creation, + /// (b) final browser destruction, (c) cross-origin navigation or (d) re- + /// navigation after renderer process termination (due to crashes, etc). + /// |old_frame| will be NULL and |new_frame| will be non-NULL when a main + /// frame is assigned to |browser| for the first time. |old_frame| will be + /// non-NULL and |new_frame| will be NULL and when a main frame is removed + /// from |browser| for the last time. Both |old_frame| and |new_frame| will be + /// non-NULL for cross-origin navigations or re-navigation after renderer + /// process termination. This function will be called after on_frame_created() + /// for |new_frame| and/or after on_frame_detached() for |old_frame|. If + /// called after cef_life_span_handler_t::on_before_close() during browser + /// destruction then cef_browser_t::is_valid() will return false (0) for + /// |browser|. + /// procedure OnMainFrameChanged(const browser: ICefBrowser; const old_frame, new_frame: ICefFrame); /// /// Custom procedure to clear all references. @@ -1186,6 +1221,12 @@ type /// ICefBeforeDownloadCallback = interface(ICefBaseRefCounted) ['{5A81AF75-CBA2-444D-AD8E-522160F36433}'] + /// + /// Call to continue the download. Set |download_path| to the full file path + /// for the download including the file name or leave blank to use the + /// suggested name and the default temp directory. Set |show_dialog| to true + /// (1) if you do wish to show the default "Save As" dialog. + /// procedure Cont(const downloadPath: ustring; showDialog: Boolean); end; @@ -1198,8 +1239,17 @@ type /// ICefDownloadItemCallback = interface(ICefBaseRefCounted) ['{498F103F-BE64-4D5F-86B7-B37EC69E1735}'] + /// + /// Call to cancel the download. + /// procedure Cancel; + /// + /// Call to pause the download. + /// procedure Pause; + /// + /// Call to resume the download. + /// procedure Resume; end; @@ -1213,8 +1263,29 @@ type /// ICefDownloadHandler = interface(ICefBaseRefCounted) ['{3137F90A-5DC5-43C1-858D-A269F28EF4F1}'] + /// + /// Called before a download begins in response to a user-initiated action + /// (e.g. alt + link click or link click that returns a `Content-Disposition: + /// attachment` response from the server). |url| is the target download URL + /// and |request_function| is the target function (GET, POST, etc). Return + /// true (1) to proceed with the download or false (0) to cancel the download. + /// function CanDownload(const browser: ICefBrowser; const url, request_method: ustring): boolean; + /// + /// Called before a download begins. |suggested_name| is the suggested name + /// for the download file. By default the download will be canceled. Execute + /// |callback| either asynchronously or in this function to continue the + /// download if desired. Do not keep a reference to |download_item| outside of + /// this function. + /// procedure OnBeforeDownload(const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const suggestedName: ustring; const callback: ICefBeforeDownloadCallback); + /// + /// Called when a download's status or progress information has been updated. + /// This may be called multiple times before and after on_before_download(). + /// Execute |callback| either asynchronously or in this function to cancel the + /// download if desired. Do not keep a reference to |download_item| outside of + /// this function. + /// procedure OnDownloadUpdated(const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const callback: ICefDownloadItemCallback); /// /// Custom procedure to clear all references. @@ -1788,10 +1859,63 @@ type /// ICefDevToolsMessageObserver = interface(ICefBaseRefCounted) ['{76E5BB2B-7F69-4BC9-94C7-B55C61CE630F}'] + /// + /// Method that will be called on receipt of a DevTools protocol message. + /// |browser| is the originating browser instance. |message| is a UTF8-encoded + /// JSON dictionary representing either a function result or an event. + /// |message| is only valid for the scope of this callback and should be + /// copied if necessary. Return true (1) if the message was handled or false + /// (0) if the message should be further processed and passed to the + /// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate. + /// + /// Method result dictionaries include an "id" (int) value that identifies the + /// orginating function call sent from + /// cef_browser_host_t::SendDevToolsMessage, and optionally either a "result" + /// (dictionary) or "error" (dictionary) value. The "error" dictionary will + /// contain "code" (int) and "message" (string) values. Event dictionaries + /// include a "function" (string) value and optionally a "params" (dictionary) + /// value. See the DevTools protocol documentation at + /// https://chromedevtools.github.io/devtools-protocol/ for details of + /// supported function calls and the expected "result" or "params" dictionary + /// contents. JSON dictionaries can be parsed using the CefParseJSON function + /// if desired, however be aware of performance considerations when parsing + /// large messages (some of which may exceed 1MB in size). + /// procedure OnDevToolsMessage(const browser: ICefBrowser; const message_: Pointer; message_size: NativeUInt; var aHandled: boolean); + /// + /// Method that will be called after attempted execution of a DevTools + /// protocol function. |browser| is the originating browser instance. + /// |message_id| is the "id" value that identifies the originating function + /// call message. If the function succeeded |success| will be true (1) and + /// |result| will be the UTF8-encoded JSON "result" dictionary value (which + /// may be NULL). If the function failed |success| will be false (0) and + /// |result| will be the UTF8-encoded JSON "error" dictionary value. |result| + /// is only valid for the scope of this callback and should be copied if + /// necessary. See the OnDevToolsMessage documentation for additional details + /// on |result| contents. + /// procedure OnDevToolsMethodResult(const browser: ICefBrowser; message_id: integer; success: boolean; const result: Pointer; result_size: NativeUInt); + /// + /// Method that will be called on receipt of a DevTools protocol event. + /// |browser| is the originating browser instance. |function| is the + /// "function" value. |params| is the UTF8-encoded JSON "params" dictionary + /// value (which may be NULL). |params| is only valid for the scope of this + /// callback and should be copied if necessary. See the OnDevToolsMessage + /// documentation for additional details on |params| contents. + /// procedure OnDevToolsEvent(const browser: ICefBrowser; const method: ustring; const params: Pointer; params_size: NativeUInt); + /// + /// Method that will be called when the DevTools agent has attached. |browser| + /// is the originating browser instance. This will generally occur in response + /// to the first message sent while the agent is detached. + /// procedure OnDevToolsAgentAttached(const browser: ICefBrowser); + /// + /// Method that will be called when the DevTools agent has detached. |browser| + /// is the originating browser instance. Any function results that were + /// pending before the agent became detached will not be delivered, and any + /// active event subscriptions will be canceled. + /// procedure OnDevToolsAgentDetached(const browser: ICefBrowser); end; @@ -1806,10 +1930,35 @@ type /// ICefMediaRouter = interface(ICefBaseRefCounted) ['{F18C3880-CB8D-48F9-9D74-DCFF4B9E88DF}'] + /// + /// Add an observer for MediaRouter events. The observer will remain + /// registered until the returned Registration object is destroyed. + /// function AddObserver(const observer: ICefMediaObserver): ICefRegistration; + /// + /// Returns a MediaSource object for the specified media source URN. Supported + /// URN schemes include "cast:" and "dial:", and will be already known by the + /// client application (e.g. "cast:?clientId="). + /// function GetSource(const urn: ustring): ICefMediaSource; + /// + /// Trigger an asynchronous call to cef_media_observer_t::OnSinks on all + /// registered observers. + /// procedure NotifyCurrentSinks; + /// + /// Create a new route between |source| and |sink|. Source and sink must be + /// valid, compatible (as reported by cef_media_sink_t::IsCompatibleWith), and + /// a route between them must not already exist. |callback| will be executed + /// on success or failure. If route creation succeeds it will also trigger an + /// asynchronous call to cef_media_observer_t::OnRoutes on all registered + /// observers. + /// procedure CreateRoute(const source: ICefMediaSource; const sink: ICefMediaSink; const callback: ICefMediaRouteCreateCallback); + /// + /// Trigger an asynchronous call to cef_media_observer_t::OnRoutes on all + /// registered observers. + /// procedure NotifyCurrentRoutes; end; @@ -1824,9 +1973,24 @@ type /// ICefMediaObserver = interface(ICefBaseRefCounted) ['{0B27C8D1-63E3-4F69-939F-DCAD518654A3}'] + /// + /// The list of available media sinks has changed or + /// cef_media_router_t::NotifyCurrentSinks was called. + /// procedure OnSinks(const sinks: TCefMediaSinkArray); + /// + /// The list of available media routes has changed or + /// cef_media_router_t::NotifyCurrentRoutes was called. + /// procedure OnRoutes(const routes: TCefMediaRouteArray); + /// + /// The connection state of |route| has changed. + /// procedure OnRouteStateChanged(const route: ICefMediaRoute; state: TCefMediaRouteConnectionState); + /// + /// A message was recieved over |route|. |message| is only valid for the scope + /// of this callback and should be copied if necessary. + /// procedure OnRouteMessageReceived(const route: ICefMediaRoute; const message_: ustring); end; @@ -1875,6 +2039,12 @@ type /// ICefMediaRouteCreateCallback = interface(ICefBaseRefCounted) ['{8848CBFE-36AC-4AC8-BC10-386B69FB27BE}'] + /// + /// Method that will be executed when the route creation has finished. + /// |result| will be CEF_MRCR_OK if the route creation succeeded. |error| will + /// be a description of the error if the route creation failed. |route| is the + /// resulting route, or NULL if the route creation failed. + /// procedure OnMediaRouteCreateFinished(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute); end; @@ -1888,6 +2058,10 @@ type /// ICefMediaSinkDeviceInfoCallback = interface(ICefBaseRefCounted) ['{633898DD-4169-45D0-ADDD-6E68B3686E0D}'] + /// + /// Method that will be executed asyncronously once device information has + /// been retrieved. + /// procedure OnMediaSinkDeviceInfo(const ip_address: ustring; port: integer; const model_name: ustring); end; @@ -1902,16 +2076,46 @@ type /// ICefMediaSink = interface(ICefBaseRefCounted) ['{EDA1A4B2-2A4C-42DD-A7DF-901BF93D908D}'] + /// + /// Returns the ID for this sink. + /// function GetId: ustring; + /// + /// Returns the name of this sink. + /// function GetName: ustring; + /// + /// Returns the icon type for this sink. + /// function GetIconType: TCefMediaSinkIconType; + /// + /// Asynchronously retrieves device info. + /// procedure GetDeviceInfo(const callback: ICefMediaSinkDeviceInfoCallback); + /// + /// Returns true (1) if this sink accepts content via Cast. + /// function IsCastSink: boolean; + /// + /// Returns true (1) if this sink accepts content via DIAL. + /// function IsDialSink: boolean; + /// + /// Returns true (1) if this sink is compatible with |source|. + /// function IsCompatibleWith(const source: ICefMediaSource): boolean; + /// + /// Returns the ID for this sink. + /// property ID : ustring read GetId; + /// + /// Returns the name of this sink. + /// property Name : ustring read GetName; + /// + /// Returns the icon type for this sink. + /// property IconType : TCefMediaSinkIconType read GetIconType; end; @@ -1927,10 +2131,21 @@ type /// ICefMediaSource = interface(ICefBaseRefCounted) ['{734ED6E4-6498-43ED-AAA4-6B993EDC30BE}'] + /// + /// Returns the ID (media source URN or URL) for this source. + /// function GetId : ustring; + /// + /// Returns true (1) if this source outputs its content via Cast. + /// function IsCastSource : boolean; + /// + /// Returns true (1) if this source outputs its content via DIAL. + /// function IsDialSource : boolean; - + /// + /// Returns the ID (media source URN or URL) for this source. + /// property ID : ustring read GetId; end; @@ -2417,6 +2632,11 @@ type /// ICefJsDialogCallback = interface(ICefBaseRefCounted) ['{187B2156-9947-4108-87AB-32E559E1B026}'] + /// + /// Continue the JS dialog request. Set |success| to true (1) if the OK button + /// was pressed. The |user_input| value should be specified for prompt + /// dialogs. + /// procedure Cont(success: Boolean; const userInput: ustring); end; @@ -2430,40 +2650,179 @@ type /// ICefContextMenuParams = interface(ICefBaseRefCounted) ['{E31BFA9E-D4E2-49B7-A05D-20018C8794EB}'] + /// + /// Returns the X coordinate of the mouse where the context menu was invoked. + /// Coords are relative to the associated RenderView's origin. + /// function GetXCoord: Integer; + /// + /// Returns the Y coordinate of the mouse where the context menu was invoked. + /// Coords are relative to the associated RenderView's origin. + /// function GetYCoord: Integer; + /// + /// Returns flags representing the type of node that the context menu was + /// invoked on. + /// function GetTypeFlags: TCefContextMenuTypeFlags; + /// + /// Returns the URL of the link, if any, that encloses the node that the + /// context menu was invoked on. + /// function GetLinkUrl: ustring; + /// + /// Returns the link URL, if any, to be used ONLY for "copy link address". We + /// don't validate this field in the frontend process. + /// function GetUnfilteredLinkUrl: ustring; + /// + /// Returns the source URL, if any, for the element that the context menu was + /// invoked on. Example of elements with source URLs are img, audio, and + /// video. + /// function GetSourceUrl: ustring; + /// + /// Returns true (1) if the context menu was invoked on an image which has + /// non-NULL contents. + /// function HasImageContents: Boolean; + /// + /// Returns the title text or the alt text if the context menu was invoked on + /// an image. + /// function GetTitleText: ustring; + /// + /// Returns the URL of the top level page that the context menu was invoked + /// on. + /// function GetPageUrl: ustring; + /// + /// Returns the URL of the subframe that the context menu was invoked on. + /// function GetFrameUrl: ustring; + /// + /// Returns the character encoding of the subframe that the context menu was + /// invoked on. + /// function GetFrameCharset: ustring; + /// + /// Returns the type of context node that the context menu was invoked on. + /// function GetMediaType: TCefContextMenuMediaType; + /// + /// Returns flags representing the actions supported by the media element, if + /// any, that the context menu was invoked on. + /// function GetMediaStateFlags: TCefContextMenuMediaStateFlags; + /// + /// Returns the text of the selection, if any, that the context menu was + /// invoked on. + /// function GetSelectionText: ustring; + /// + /// Returns the text of the misspelled word, if any, that the context menu was + /// invoked on. + /// function GetMisspelledWord: ustring; + /// + /// Returns true (1) if suggestions exist, false (0) otherwise. Fills in + /// |suggestions| from the spell check service for the misspelled word if + /// there is one. + /// function GetDictionarySuggestions(const suggestions: TStringList): Boolean; + /// + /// Returns true (1) if the context menu was invoked on an editable node. + /// function IsEditable: Boolean; + /// + /// Returns true (1) if the context menu was invoked on an editable node where + /// spell-check is enabled. + /// function IsSpellCheckEnabled: Boolean; + /// + /// Returns flags representing the actions supported by the editable node, if + /// any, that the context menu was invoked on. + /// function GetEditStateFlags: TCefContextMenuEditStateFlags; + /// + /// Returns true (1) if the context menu contains items specified by the + /// renderer process. + /// function IsCustomMenu: Boolean; + /// + /// Returns the X coordinate of the mouse where the context menu was invoked. + /// Coords are relative to the associated RenderView's origin. + /// property XCoord : Integer read GetXCoord; + /// + /// Returns the Y coordinate of the mouse where the context menu was invoked. + /// Coords are relative to the associated RenderView's origin. + /// property YCoord : Integer read GetYCoord; + /// + /// Returns flags representing the type of node that the context menu was + /// invoked on. + /// property TypeFlags : TCefContextMenuTypeFlags read GetTypeFlags; + /// + /// Returns the URL of the link, if any, that encloses the node that the + /// context menu was invoked on. + /// property LinkUrl : ustring read GetLinkUrl; + /// + /// Returns the link URL, if any, to be used ONLY for "copy link address". We + /// don't validate this field in the frontend process. + /// property UnfilteredLinkUrl : ustring read GetUnfilteredLinkUrl; + /// + /// Returns the source URL, if any, for the element that the context menu was + /// invoked on. Example of elements with source URLs are img, audio, and + /// video. + /// property SourceUrl : ustring read GetSourceUrl; + /// + /// Returns the title text or the alt text if the context menu was invoked on + /// an image. + /// property TitleText : ustring read GetTitleText; + /// + /// Returns the URL of the top level page that the context menu was invoked + /// on. + /// property PageUrl : ustring read GetPageUrl; + /// + /// Returns the URL of the subframe that the context menu was invoked on. + /// property FrameUrl : ustring read GetFrameUrl; + /// + /// Returns the character encoding of the subframe that the context menu was + /// invoked on. + /// property FrameCharset : ustring read GetFrameCharset; + /// + /// Returns the type of context node that the context menu was invoked on. + /// property MediaType : TCefContextMenuMediaType read GetMediaType; + /// + /// Returns flags representing the actions supported by the media element, if + /// any, that the context menu was invoked on. + /// property MediaStateFlags : TCefContextMenuMediaStateFlags read GetMediaStateFlags; + /// + /// Returns the text of the selection, if any, that the context menu was + /// invoked on. + /// property SelectionText : ustring read GetSelectionText; + /// + /// Returns the text of the misspelled word, if any, that the context menu was + /// invoked on. + /// + property MisspelledWord : ustring read GetMisspelledWord; + /// + /// Returns flags representing the actions supported by the editable node, if + /// any, that the context menu was invoked on. + /// property EditStateFlags : TCefContextMenuEditStateFlags read GetEditStateFlags; end; @@ -2684,9 +3043,138 @@ type /// ICefLifeSpanHandler = interface(ICefBaseRefCounted) ['{0A3EB782-A319-4C35-9B46-09B2834D7169}'] + /// + /// Called on the UI thread before a new popup browser is created. The + /// |browser| and |frame| values represent the source of the popup request. + /// The |target_url| and |target_frame_name| values indicate where the popup + /// browser should navigate and may be NULL if not specified with the request. + /// The |target_disposition| value indicates where the user intended to open + /// the popup (e.g. current tab, new tab, etc). The |user_gesture| value will + /// be true (1) if the popup was opened via explicit user gesture (e.g. + /// clicking a link) or false (0) if the popup opened automatically (e.g. via + /// the DomContentLoaded event). The |popupFeatures| structure contains + /// additional information about the requested popup window. To allow creation + /// of the popup browser optionally modify |windowInfo|, |client|, |settings| + /// and |no_javascript_access| and return false (0). To cancel creation of the + /// popup browser return true (1). The |client| and |settings| values will + /// default to the source browser's values. If the |no_javascript_access| + /// value is set to false (0) the new browser will not be scriptable and may + /// not be hosted in the same renderer process as the source browser. Any + /// modifications to |windowInfo| will be ignored if the parent browser is + /// wrapped in a cef_browser_view_t. Popup browser creation will be canceled + /// if the parent browser is destroyed before the popup browser creation + /// completes (indicated by a call to OnAfterCreated for the popup browser). + /// The |extra_info| parameter provides an opportunity to specify extra + /// information specific to the created popup browser that will be passed to + /// cef_render_process_handler_t::on_browser_created() in the render process. + /// function OnBeforePopup(const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean): Boolean; + /// + /// Called after a new browser is created. It is now safe to begin performing + /// actions with |browser|. cef_frame_handler_t callbacks related to initial + /// main frame creation will arrive before this callback. See + /// cef_frame_handler_t documentation for additional usage information. + /// procedure OnAfterCreated(const browser: ICefBrowser); + /// + /// Called when a browser has recieved a request to close. This may result + /// directly from a call to cef_browser_host_t::*close_browser() 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 + /// do_close() function will be called after the JavaScript 'onunload' event + /// has been fired. + /// + /// An application should handle top-level owner window close notifications by + /// calling cef_browser_host_t::try_close_browser() or + /// cef_browser_host_t::CloseBrowser(false (0)) 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 do_close() 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 do_close() + /// 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 cef_window_delegate_t::can_close() callback from Views). If the + /// browser's host window/view has already been destroyed (via view hierarchy + /// tear-down, for example) then do_close() 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 do_close() + /// 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 do_close() and return true + /// (1). + /// + /// The cef_life_span_handler_t::on_before_close() function will be called + /// after do_close() (if do_close() is called) and immediately before the + /// browser object is destroyed. The application should only exit after + /// on_before_close() 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 cef_browser_host_t::try_close_browser(). 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 + /// CefJSDialogHandler::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 DoClose() 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 on_before_close() 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 cef_browser_host_t::CloseBrowser(false (0)) and + /// implementing the do_close() 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 CefBrowserHost::CloseBrowser(false). + /// B. Cancels the window close. + /// 3. JavaScript 'onbeforeunload' handler executes and shows the close + /// confirmation dialog (which can be overridden via + /// CefJSDialogHandler::OnBeforeUnloadDialog()). + /// 4. User approves the close. + /// 5. JavaScript 'onunload' handler executes. + /// 6. Application's do_close() 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 on_before_close() handler is called and the browser object is destroyed. + /// 11. Application exits by calling cef_quit_message_loop() if no other browsers exist. + /// function DoClose(const browser: ICefBrowser): Boolean; + /// + /// 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. cef_frame_handler_t callbacks related to final main frame + /// destruction will arrive after this callback and cef_browser_t::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 cef_resource_request_handler_t callbacks related to those requests may + /// still arrive on the IO thread after this callback. See cef_frame_handler_t + /// and do_close() documentation for additional usage information. + /// procedure OnBeforeClose(const browser: ICefBrowser); /// /// Custom procedure to clear all references. @@ -2704,10 +3192,41 @@ type /// ICefCommandHandler = interface(ICefBaseRefCounted) ['{7C931B93-53DC-4607-AABB-2CB4AEF7FB96}'] + /// + /// Called to execute a Chrome command triggered via menu selection or + /// keyboard shortcut. Values for |command_id| can be found in the + /// cef_command_ids.h file. |disposition| provides information about the + /// intended command target. Return true (1) if the command was handled or + /// false (0) for the default implementation. For context menu commands this + /// will be called after cef_context_menu_handler_t::OnContextMenuCommand. + /// Only used with the Chrome runtime. + /// function OnChromeCommand(const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition): boolean; + /// + /// Called to check if a Chrome app menu item should be visible. Values for + /// |command_id| can be found in the cef_command_ids.h file. Only called for + /// menu items that would be visible by default. Only used with the Chrome + /// runtime. + /// function OnIsChromeAppMenuItemVisible(const browser: ICefBrowser; command_id: integer): boolean; + /// + /// Called to check if a Chrome app menu item should be enabled. Values for + /// |command_id| can be found in the cef_command_ids.h file. Only called for + /// menu items that would be enabled by default. Only used with the Chrome + /// runtime. + /// function OnIsChromeAppMenuItemEnabled(const browser: ICefBrowser; command_id: integer): boolean; + /// + /// Called during browser creation to check if a Chrome page action icon + /// should be visible. Only called for icons that would be visible by default. + /// Only used with the Chrome runtime. + /// function OnIsChromePageActionIconVisible(icon_type: TCefChromePageActionIconType): boolean; + /// + /// Called during browser creation to check if a Chrome toolbar button should + /// be visible. Only called for buttons that would be visible by default. Only + /// used with the Chrome runtime. + /// function OnIsChromeToolbarButtonVisible(button_type: TCefChromeToolbarButtonType): boolean; /// /// Custom procedure to clear all references. @@ -2725,7 +3244,13 @@ type /// ICefGetExtensionResourceCallback = interface(ICefBaseRefCounted) ['{579C8602-8252-40D0-9E0A-501F32C36C42}'] + /// + /// Continue the request. Read the resource contents from |stream|. + /// procedure cont(const stream: ICefStreamReader); + /// + /// Cancel the request. + /// procedure cancel; end; @@ -2741,13 +3266,82 @@ type /// ICefExtensionHandler = interface(ICefBaseRefCounted) ['{3234008F-D809-459D-963D-23BA50219648}'] + /// + /// Called if the cef_request_context_t::LoadExtension request fails. |result| + /// will be the error code. + /// procedure OnExtensionLoadFailed(result: TCefErrorcode); + /// + /// Called if the cef_request_context_t::LoadExtension request succeeds. + /// |extension| is the loaded extension. + /// procedure OnExtensionLoaded(const extension: ICefExtension); + /// + /// Called after the cef_extension_t::Unload request has completed. + /// procedure OnExtensionUnloaded(const extension: ICefExtension); + /// + /// Called when an extension needs a browser to host a background script + /// specified via the "background" manifest key. The browser will have no + /// visible window and cannot be displayed. |extension| is the extension that + /// is loading the background script. |url| is an internally generated + /// reference to an HTML page that will be used to load the background script + /// via a "