mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-15 07:45:56 +01:00
Added more XML documentation
This commit is contained in:
parent
d94c08a349
commit
0fe7711425
@ -94,6 +94,7 @@ type
|
||||
function GetWindowHandle: TCefWindowHandle;
|
||||
function GetOpenerWindowHandle: TCefWindowHandle;
|
||||
function HasView: Boolean;
|
||||
function GetClient: ICefClient;
|
||||
function GetRequestContext: ICefRequestContext;
|
||||
function GetZoomLevel: Double;
|
||||
procedure SetZoomLevel(const zoomLevel: Double);
|
||||
@ -159,7 +160,7 @@ implementation
|
||||
uses
|
||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFDownloadImageCallBack, uCEFFrame, uCEFPDFPrintCallback,
|
||||
uCEFRunFileDialogCallback, uCEFRequestContext, uCEFNavigationEntryVisitor, uCEFNavigationEntry,
|
||||
uCEFExtension, uCEFStringList, uCEFRegistration;
|
||||
uCEFExtension, uCEFStringList, uCEFRegistration, uCEFClient;
|
||||
|
||||
|
||||
// TCefBrowserRef
|
||||
@ -561,6 +562,11 @@ begin
|
||||
Result := PCefBrowserHost(FData)^.get_opener_window_handle(PCefBrowserHost(FData));
|
||||
end;
|
||||
|
||||
function TCefBrowserHostRef.GetClient: ICefClient;
|
||||
begin
|
||||
Result := TCefClientRef.UnWrap(PCefBrowserHost(FData)^.get_client(PCefBrowserHost(FData)));
|
||||
end;
|
||||
|
||||
function TCefBrowserHostRef.GetRequestContext: ICefRequestContext;
|
||||
begin
|
||||
Result := TCefRequestContextRef.UnWrap(PCefBrowserHost(FData)^.get_request_context(PCefBrowserHost(FData)));
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1750,10 +1750,25 @@ const
|
||||
|
||||
DEVTOOLS_WINDOWNAME = 'DevTools';
|
||||
|
||||
/// <summary>
|
||||
/// Direct proxy type: Never use a proxy.
|
||||
/// </summary>
|
||||
CEF_PROXYTYPE_DIRECT = 0;
|
||||
/// <summary>
|
||||
/// Auto_detect proxy type: Auto detect proxy settings.
|
||||
/// </summary>
|
||||
CEF_PROXYTYPE_AUTODETECT = 1;
|
||||
/// <summary>
|
||||
/// System proxy type: Use system proxy settings.
|
||||
/// </summary>
|
||||
CEF_PROXYTYPE_SYSTEM = 2;
|
||||
/// <summary>
|
||||
/// Fixed_servers proxy type: Use fixed proxy servers.
|
||||
/// </summary>
|
||||
CEF_PROXYTYPE_FIXED_SERVERS = 3;
|
||||
/// <summary>
|
||||
/// Pac_script proxy type: Use a .pac proxy script.
|
||||
/// </summary>
|
||||
CEF_PROXYTYPE_PAC_SCRIPT = 4;
|
||||
|
||||
/// <summary>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -69,6 +69,9 @@ const
|
||||
|
||||
type
|
||||
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pfidWindows or pfidOSX or pfidLinux)]{$ENDIF}{$ENDIF}
|
||||
/// <summary>
|
||||
/// The TCEFServerComponent class puts together all CEF server procedures, functions, properties and events in one place.
|
||||
/// </summary>
|
||||
TCEFServerComponent = class(TComponent, IServerEvents)
|
||||
protected
|
||||
FHandler : ICefServerHandler;
|
||||
@ -105,31 +108,211 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new server that binds to |address| and |port|. |address| must be a
|
||||
/// valid IPv4 or IPv6 address (e.g. 127.0.0.1 or ::1) and |port| must be a port
|
||||
/// number outside of the reserved range (e.g. between 1025 and 65535 on most
|
||||
/// platforms). |backlog| is the maximum number of pending connections. A new
|
||||
/// thread will be created for each CreateServer call (the "dedicated server
|
||||
/// thread"). It is therefore recommended to use a different
|
||||
/// ICefServerHandler instance for each CreateServer call to avoid thread
|
||||
/// safety issues in the ICefServerHandler implementation. The
|
||||
/// ICefServerHandler.OnServerCreated function will be called on the
|
||||
/// dedicated server thread to report success or failure. See
|
||||
/// ICefServerHandler.OnServerCreated documentation for a description of
|
||||
/// server lifespan.
|
||||
/// </summary>
|
||||
procedure CreateServer(const address : ustring = DEFAULT_CEFSERVER_ADDRESS; port : uint16 = DEFAULT_CEFSERVER_PORT; backlog : Integer = DEFAULT_CEFSERVER_BACKLOG);
|
||||
/// <summary>
|
||||
/// Stop the server and shut down the dedicated server thread. See
|
||||
/// ICefServerHandler.OnServerCreated documentation for a description of
|
||||
/// server lifespan.
|
||||
/// </summary>
|
||||
procedure Shutdown;
|
||||
/// <summary>
|
||||
/// Returns true (1) if |connection_id| represents a valid connection. This
|
||||
/// function must be called on the dedicated server thread.
|
||||
/// </summary>
|
||||
function IsValidConnection(connection_id: Integer) : boolean;
|
||||
/// <summary>
|
||||
/// Send an HTTP 200 "OK" response to the connection identified by
|
||||
/// |connection_id|. |content_type| is the response content type (e.g.
|
||||
/// "text/html"), |data| is the response content, and |data_size| is the size
|
||||
/// of |data| in bytes. The contents of |data| will be copied. The connection
|
||||
/// will be closed automatically after the response is sent.
|
||||
/// </summary>
|
||||
procedure SendHttp200response(connection_id: Integer; const content_type: ustring; const data: Pointer; data_size: NativeUInt);
|
||||
/// <summary>
|
||||
/// Send an HTTP 404 "Not Found" response to the connection identified by
|
||||
/// |connection_id|. The connection will be closed automatically after the
|
||||
/// response is sent.
|
||||
/// </summary>
|
||||
procedure SendHttp404response(connection_id: Integer);
|
||||
/// <summary>
|
||||
/// Send an HTTP 500 "Internal Server Error" response to the connection
|
||||
/// identified by |connection_id|. |error_message| is the associated error
|
||||
/// message. The connection will be closed automatically after the response is
|
||||
/// sent.
|
||||
/// </summary>
|
||||
procedure SendHttp500response(connection_id: Integer; const error_message: ustring);
|
||||
/// <summary>
|
||||
/// Send a custom HTTP response to the connection identified by
|
||||
/// |connection_id|. |response_code| is the HTTP response code sent in the
|
||||
/// status line (e.g. 200), |content_type| is the response content type sent
|
||||
/// as the "Content-Type" header (e.g. "text/html"), |content_length| is the
|
||||
/// expected content length, and |extra_headers| is the map of extra response
|
||||
/// headers. If |content_length| is >= 0 then the "Content-Length" header will
|
||||
/// be sent. If |content_length| is 0 then no content is expected and the
|
||||
/// connection will be closed automatically after the response is sent. If
|
||||
/// |content_length| is < 0 then no "Content-Length" header will be sent and
|
||||
/// the client will continue reading until the connection is closed. Use the
|
||||
/// SendRawData function to send the content, if applicable, and call
|
||||
/// CloseConnection after all content has been sent.
|
||||
/// </summary>
|
||||
procedure SendHttpResponse(connection_id, response_code: Integer; const content_type: ustring; content_length: int64; const extra_headers: ICefStringMultimap);
|
||||
/// <summary>
|
||||
/// Send raw data directly to the connection identified by |connection_id|.
|
||||
/// |data| is the raw data and |data_size| is the size of |data| in bytes. The
|
||||
/// contents of |data| will be copied. No validation of |data| is performed
|
||||
/// internally so the client should be careful to send the amount indicated by
|
||||
/// the "Content-Length" header, if specified. See SendHttpResponse
|
||||
/// documentation for intended usage.
|
||||
/// </summary>
|
||||
procedure SendRawData(connection_id: Integer; const data: Pointer; data_size: NativeUInt);
|
||||
/// <summary>
|
||||
/// Close the connection identified by |connection_id|. See SendHttpResponse
|
||||
/// documentation for intended usage.
|
||||
/// </summary>
|
||||
procedure CloseConnection(connection_id: Integer);
|
||||
/// <summary>
|
||||
/// Send a WebSocket message to the connection identified by |connection_id|.
|
||||
/// |data| is the response content and |data_size| is the size of |data| in
|
||||
/// bytes. The contents of |data| will be copied. See
|
||||
/// ICefServerHandler.OnWebSocketRequest documentation for intended usage.
|
||||
/// </summary>
|
||||
procedure SendWebSocketMessage(connection_id: Integer; const data: Pointer; data_size: NativeUInt);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when the server and the handler are initialized.
|
||||
/// </summary>
|
||||
property Initialized : boolean read GetInitialized;
|
||||
/// <summary>
|
||||
/// Returns true (1) if the server is currently running and accepting incoming
|
||||
/// connections. See ICefServerHandler.OnServerCreated documentation for a
|
||||
/// description of server lifespan. This function must be called on the
|
||||
/// dedicated server thread.
|
||||
/// </summary>
|
||||
property IsRunning : boolean read GetIsRunning;
|
||||
/// <summary>
|
||||
/// Returns the server address including the port number.
|
||||
/// </summary>
|
||||
property Address : ustring read GetAddress;
|
||||
/// <summary>
|
||||
/// Returns true (1) if the server currently has a connection. This function
|
||||
/// must be called on the dedicated server thread.
|
||||
/// </summary>
|
||||
property HasConnection : boolean read GetHasConnection;
|
||||
|
||||
published
|
||||
/// <summary>
|
||||
/// Called when |server| is created. If the server was started successfully
|
||||
/// then ICefServer.IsRunning will return true (1). The server will
|
||||
/// continue running until ICefServerShutdown is called, after which time
|
||||
/// OnServerDestroyed will be called. If the server failed to start then
|
||||
/// OnServerDestroyed will be called immediately after this function returns.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the CEF server thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_server_capi.h">CEF source file: /include/capi/cef_server_capi.h (cef_server_handler_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnServerCreated : TOnServerCreated read FOnServerCreated write FOnServerCreated;
|
||||
/// <summary>
|
||||
/// Called when |server| is destroyed. The server thread will be stopped after
|
||||
/// this function returns. The client should release any references to
|
||||
/// |server| when this function is called. See OnServerCreated documentation
|
||||
/// for a description of server lifespan.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the CEF server thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_server_capi.h">CEF source file: /include/capi/cef_server_capi.h (cef_server_handler_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnServerDestroyed : TOnServerDestroyed read FOnServerDestroyed write FOnServerDestroyed;
|
||||
/// <summary>
|
||||
/// Called when a client connects to |server|. |connection_id| uniquely
|
||||
/// identifies the connection. Each call to this function will have a matching
|
||||
/// call to OnClientDisconnected.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the CEF server thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_server_capi.h">CEF source file: /include/capi/cef_server_capi.h (cef_server_handler_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnClientConnected : TOnClientConnected read FOnClientConnected write FOnClientConnected;
|
||||
/// <summary>
|
||||
/// Called when a client disconnects from |server|. |connection_id| uniquely
|
||||
/// identifies the connection. The client should release any data associated
|
||||
/// with |connection_id| when this function is called and |connection_id|
|
||||
/// should no longer be passed to ICefServer functions. Disconnects can
|
||||
/// originate from either the client or the server. For example, the server
|
||||
/// will disconnect automatically after a ICefServer.SendHttpXXXResponse
|
||||
/// function is called.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the CEF server thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_server_capi.h">CEF source file: /include/capi/cef_server_capi.h (cef_server_handler_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnClientDisconnected : TOnClientDisconnected read FOnClientDisconnected write FOnClientDisconnected;
|
||||
/// <summary>
|
||||
/// Called when |server| receives an HTTP request. |connection_id| uniquely
|
||||
/// identifies the connection, |client_address| is the requesting IPv4 or IPv6
|
||||
/// client address including port number, and |request| contains the request
|
||||
/// contents (URL, function, headers and optional POST data). Call
|
||||
/// ICefServer functions either synchronously or asynchronusly to send a
|
||||
/// response.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the CEF server thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_server_capi.h">CEF source file: /include/capi/cef_server_capi.h (cef_server_handler_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnHttpRequest : TOnHttpRequest read FOnHttpRequest write FOnHttpRequest;
|
||||
/// <summary>
|
||||
/// Called when |server| receives a WebSocket request. |connection_id|
|
||||
/// uniquely identifies the connection, |client_address| is the requesting
|
||||
/// IPv4 or IPv6 client address including port number, and |request| contains
|
||||
/// the request contents (URL, function, headers and optional POST data).
|
||||
/// Execute |callback| either synchronously or asynchronously to accept or
|
||||
/// decline the WebSocket connection. If the request is accepted then
|
||||
/// OnWebSocketConnected will be called after the WebSocket has connected and
|
||||
/// incoming messages will be delivered to the OnWebSocketMessage callback. If
|
||||
/// the request is declined then the client will be disconnected and
|
||||
/// OnClientDisconnected will be called. Call the
|
||||
/// ICefServer.SendWebSocketMessage function after receiving the
|
||||
/// OnWebSocketConnected callback to respond with WebSocket messages.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the CEF server thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_server_capi.h">CEF source file: /include/capi/cef_server_capi.h (cef_server_handler_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnWebSocketRequest : TOnWebSocketRequest read FOnWebSocketRequest write FOnWebSocketRequest;
|
||||
/// <summary>
|
||||
/// Called after the client has accepted the WebSocket connection for |server|
|
||||
/// and |connection_id| via the OnWebSocketRequest callback. See
|
||||
/// OnWebSocketRequest documentation for intended usage.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the CEF server thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_server_capi.h">CEF source file: /include/capi/cef_server_capi.h (cef_server_handler_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnWebSocketConnected : TOnWebSocketConnected read FOnWebSocketConnected write FOnWebSocketConnected;
|
||||
/// <summary>
|
||||
/// Called when |server| receives an WebSocket message. |connection_id|
|
||||
/// uniquely identifies the connection, |data| is the message content and
|
||||
/// |data_size| is the size of |data| in bytes. Do not keep a reference to
|
||||
/// |data| outside of this function. See OnWebSocketRequest documentation for
|
||||
/// intended usage.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the CEF server thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_server_capi.h">CEF source file: /include/capi/cef_server_capi.h (cef_server_handler_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnWebSocketMessage : TOnWebSocketMessage read FOnWebSocketMessage write FOnWebSocketMessage;
|
||||
end;
|
||||
|
||||
|
@ -70,6 +70,7 @@ type
|
||||
class function CreateForCustomStream(const stream: ICefCustomStreamReader): ICefStreamReader;
|
||||
class function CreateForStream(const stream: TSTream; owned: Boolean): ICefStreamReader;
|
||||
class function CreateForData(data: Pointer; size: NativeUInt): ICefStreamReader;
|
||||
class function CreateForHandler(const handler: ICefReadHandler): ICefStreamReader;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -87,6 +88,11 @@ begin
|
||||
Result := UnWrap(cef_stream_reader_create_for_data(data, size))
|
||||
end;
|
||||
|
||||
class function TCefStreamReaderRef.CreateForHandler(const handler: ICefReadHandler): ICefStreamReader;
|
||||
begin
|
||||
Result := UnWrap(cef_stream_reader_create_for_handler(CefGetData(handler)));
|
||||
end;
|
||||
|
||||
class function TCefStreamReaderRef.CreateForFile(const filename: ustring): ICefStreamReader;
|
||||
var
|
||||
TempFileName : TCefString;
|
||||
|
@ -984,7 +984,7 @@ type
|
||||
/// Values used by the battery saver mode state preference
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para><see href="https://source.chromium.org/chromium/chromium/src/+/main:components/performance_manager/public/user_tuning/prefs.h">prefs.h</see></para>
|
||||
/// <para><see href="https://source.chromium.org/chromium/chromium/src/+/main:components/performance_manager/public/user_tuning/prefs.h">components/performance_manager/public/user_tuning/prefs.h</see></para>
|
||||
/// </remarks>
|
||||
TCefBatterySaverModeState = (
|
||||
bsmsDisabled = 0,
|
||||
@ -997,6 +997,22 @@ type
|
||||
bsmsDefault = 4
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Values used by the high efficiency mode state preference
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para><see href="https://source.chromium.org/chromium/chromium/src/+/main:components/performance_manager/public/user_tuning/prefs.h">components/performance_manager/public/user_tuning/prefs.h</see></para>
|
||||
/// </remarks>
|
||||
TCefHighEfficiencyModeState = (
|
||||
kDisabled = 0,
|
||||
kEnabled = 1,
|
||||
kEnabledOnTimer = 2,
|
||||
/// <summary>
|
||||
/// Custom value used to update the preferences only when there's a non-default value
|
||||
/// </summary>
|
||||
kDefault = 3
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Used by TCEFFileDialogInfo
|
||||
/// </summary>
|
||||
|
@ -55,6 +55,7 @@ type
|
||||
TCefUrlRequestRef = class(TCefBaseRefCountedRef, ICefUrlRequest)
|
||||
protected
|
||||
function GetRequest: ICefRequest;
|
||||
function GetClient: ICefUrlrequestClient;
|
||||
function GetRequestStatus: TCefUrlRequestStatus;
|
||||
function GetRequestError: Integer;
|
||||
function GetResponse: ICefResponse;
|
||||
@ -69,7 +70,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFRequest, uCEFResponse;
|
||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFRequest, uCEFResponse, uCEFUrlrequestClient;
|
||||
|
||||
procedure TCefUrlRequestRef.Cancel;
|
||||
begin
|
||||
@ -88,6 +89,11 @@ begin
|
||||
Result := TCefRequestRef.UnWrap(PCefUrlRequest(FData)^.get_request(PCefUrlRequest(FData)));
|
||||
end;
|
||||
|
||||
function TCefUrlRequestRef.GetClient: ICefUrlrequestClient;
|
||||
begin
|
||||
Result := TCefUrlrequestClientRef.UnWrap(PCefUrlRequest(FData)^.get_client(PCefUrlRequest(FData)));
|
||||
end;
|
||||
|
||||
function TCefUrlRequestRef.GetRequestError: Integer;
|
||||
begin
|
||||
Result := PCefUrlRequest(FData)^.get_request_error(PCefUrlRequest(FData));
|
||||
|
@ -64,6 +64,9 @@ uses
|
||||
|
||||
type
|
||||
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pfidWindows or pfidOSX or pfidLinux)]{$ENDIF}{$ENDIF}
|
||||
/// <summary>
|
||||
/// The TCEFUrlRequestClientComponent class puts together all CEF URL request procedures, functions, properties and events in one place.
|
||||
/// </summary>
|
||||
TCEFUrlRequestClientComponent = class(TComponent, ICEFUrlRequestClientEvents)
|
||||
protected
|
||||
FClient : ICefUrlrequestClient;
|
||||
@ -92,18 +95,81 @@ type
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure AfterConstruction; override;
|
||||
procedure BeforeDestruction; override;
|
||||
|
||||
/// <summary>
|
||||
/// Create the URLRequest in the context of TCEFUrlRequestClientComponent.ThreadId, which is the CEF UI thread by default.
|
||||
/// </summary>
|
||||
procedure AddURLRequest;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the client.
|
||||
/// </summary>
|
||||
property Client : ICefUrlrequestClient read FClient;
|
||||
/// <summary>
|
||||
/// CEF thread used to create the URLRequest. Most of the client events will be executed on the same thread.
|
||||
/// </summary>
|
||||
property ThreadID : TCefThreadId read FThreadID write FThreadID;
|
||||
|
||||
published
|
||||
/// <summary>
|
||||
/// Notifies the client that the request has completed. Use the
|
||||
/// ICefUrlRequest.GetRequestStatus function to determine if the request
|
||||
/// was successful or not.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the TCEFUrlRequestClientComponent.ThreadId thread, which is the CEF UI thread by default.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_urlrequest_capi.h">CEF source file: /include/capi/cef_urlrequest_capi.h (cef_urlrequest_client_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnRequestComplete : TOnRequestComplete read FOnRequestComplete write FOnRequestComplete;
|
||||
/// <summary>
|
||||
/// Notifies the client of upload progress. |current| denotes the number of
|
||||
/// bytes sent so far and |total| is the total size of uploading data (or -1
|
||||
/// if chunked upload is enabled). This function will only be called if the
|
||||
/// UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the TCEFUrlRequestClientComponent.ThreadId thread, which is the CEF UI thread by default.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_urlrequest_capi.h">CEF source file: /include/capi/cef_urlrequest_capi.h (cef_urlrequest_client_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnUploadProgress : TOnUploadProgress read FOnUploadProgress write FOnUploadProgress;
|
||||
/// <summary>
|
||||
/// Notifies the client of download progress. |current| denotes the number of
|
||||
/// bytes received up to the call and |total| is the expected total size of
|
||||
/// the response (or -1 if not determined).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the TCEFUrlRequestClientComponent.ThreadId thread, which is the CEF UI thread by default.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_urlrequest_capi.h">CEF source file: /include/capi/cef_urlrequest_capi.h (cef_urlrequest_client_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnDownloadProgress : TOnDownloadProgress read FOnDownloadProgress write FOnDownloadProgress;
|
||||
/// <summary>
|
||||
/// Called when some part of the response is read. |data| contains the current
|
||||
/// bytes received since the last call. This function will not be called if
|
||||
/// the UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the TCEFUrlRequestClientComponent.ThreadId thread, which is the CEF UI thread by default.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_urlrequest_capi.h">CEF source file: /include/capi/cef_urlrequest_capi.h (cef_urlrequest_client_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnDownloadData : TOnDownloadData read FOnDownloadData write FOnDownloadData;
|
||||
/// <summary>
|
||||
/// Called on the IO thread when the browser needs credentials from the user.
|
||||
/// |isProxy| indicates whether the host is a proxy server. |host| contains
|
||||
/// the hostname and |port| contains the port number. Return true (1) to
|
||||
/// continue the request and call ICefAuthCallback.cont() when the
|
||||
/// authentication information is available. If the request has an associated
|
||||
/// browser/frame then returning false (0) will result in a call to
|
||||
/// GetAuthCredentials on the ICefRequestHandler associated with that
|
||||
/// browser, if any. Otherwise, returning false (0) will cancel the request
|
||||
/// immediately. This function will only be called for requests initiated from
|
||||
/// the browser process.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This event will be called on the browser process CEF IO thread.</para>
|
||||
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_urlrequest_capi.h">CEF source file: /include/capi/cef_urlrequest_capi.h (cef_urlrequest_client_t)</see></para>
|
||||
/// </remarks>
|
||||
property OnGetAuthCredentials : TOnGetAuthCredentials read FOnGetAuthCredentials write FOnGetAuthCredentials;
|
||||
/// <summary>
|
||||
/// Event triggered when the URLRequest has been created.
|
||||
/// </summary>
|
||||
property OnCreateURLRequest : TNotifyEvent read FOnCreateURLRequest write FOnCreateURLRequest;
|
||||
end;
|
||||
|
||||
|
@ -83,6 +83,18 @@ type
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
TCefUrlrequestClientRef = class(TCefBaseRefCountedRef, ICefUrlrequestClient)
|
||||
protected
|
||||
procedure OnRequestComplete(const request: ICefUrlRequest);
|
||||
procedure OnUploadProgress(const request: ICefUrlRequest; current, total: Int64);
|
||||
procedure OnDownloadProgress(const request: ICefUrlRequest; current, total: Int64);
|
||||
procedure OnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt);
|
||||
function OnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean;
|
||||
procedure RemoveReferences;
|
||||
public
|
||||
class function UnWrap(data: Pointer): ICefUrlrequestClient;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -297,4 +309,51 @@ begin
|
||||
FEvents := nil;
|
||||
end;
|
||||
|
||||
|
||||
// TCefUrlrequestClientRef
|
||||
|
||||
procedure TCefUrlrequestClientRef.OnRequestComplete(const request: ICefUrlRequest);
|
||||
begin
|
||||
PCefUrlRequestClient(FData)^.on_request_complete(PCefUrlRequestClient(FData), CefGetData(request));
|
||||
end;
|
||||
|
||||
procedure TCefUrlrequestClientRef.OnUploadProgress(const request: ICefUrlRequest; current, total: Int64);
|
||||
begin
|
||||
PCefUrlRequestClient(FData)^.on_upload_progress(PCefUrlRequestClient(FData), CefGetData(request), current, total);
|
||||
end;
|
||||
|
||||
procedure TCefUrlrequestClientRef.OnDownloadProgress(const request: ICefUrlRequest; current, total: Int64);
|
||||
begin
|
||||
PCefUrlRequestClient(FData)^.on_download_progress(PCefUrlRequestClient(FData), CefGetData(request), current, total);
|
||||
end;
|
||||
|
||||
procedure TCefUrlrequestClientRef.OnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt);
|
||||
begin
|
||||
PCefUrlRequestClient(FData)^.on_download_data(PCefUrlRequestClient(FData), CefGetData(request), data, dataLength);
|
||||
end;
|
||||
|
||||
function TCefUrlrequestClientRef.OnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean;
|
||||
var
|
||||
TempHost, TempRealm, TempScheme : TCefString;
|
||||
begin
|
||||
TempHost := CefString(host);
|
||||
TempRealm := CefString(realm);
|
||||
TempScheme := CefString(scheme);
|
||||
Result := PCefUrlRequestClient(FData)^.get_auth_credentials(PCefUrlRequestClient(FData), ord(isProxy), @TempHost, port, @TempRealm, @TempScheme, CefGetData(callback)) <> 0;
|
||||
end;
|
||||
|
||||
procedure TCefUrlrequestClientRef.RemoveReferences;
|
||||
begin
|
||||
//
|
||||
end;
|
||||
|
||||
class function TCefUrlrequestClientRef.UnWrap(data: Pointer): ICEFUrlRequestClient;
|
||||
begin
|
||||
if (data <> nil) then
|
||||
Result := Create(data) as ICEFUrlRequestClient
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
@ -2,7 +2,7 @@
|
||||
"UpdateLazPackages" : [
|
||||
{
|
||||
"ForceNotify" : true,
|
||||
"InternalVersion" : 498,
|
||||
"InternalVersion" : 499,
|
||||
"Name" : "cef4delphi_lazarus.lpk",
|
||||
"Version" : "115.3.11"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user