2018-03-29 20:02:04 +02:00
|
|
|
|
// ************************************************************************
|
2017-09-19 19:18:52 +02:00
|
|
|
|
// ***************************** CEF4Delphi *******************************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
//
|
2019-10-19 10:58:34 +02:00
|
|
|
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
2017-09-19 19:18:52 +02:00
|
|
|
|
// browser in Delphi applications.
|
|
|
|
|
//
|
|
|
|
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
|
|
|
|
//
|
|
|
|
|
// For more information about CEF4Delphi visit :
|
|
|
|
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
|
|
|
|
//
|
2019-01-08 19:15:25 +01:00
|
|
|
|
// Copyright <20> 2019 Salvador Diaz Fau. All rights reserved.
|
2017-09-19 19:18:52 +02:00
|
|
|
|
//
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
// ************ vvvv Original license and comments below vvvv *************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
(*
|
|
|
|
|
* Delphi Chromium Embedded 3
|
|
|
|
|
*
|
|
|
|
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
|
|
|
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
|
|
|
|
*
|
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
|
|
|
* the specific language governing rights and limitations under the License.
|
|
|
|
|
*
|
|
|
|
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
|
|
|
|
* Web site : http://www.progdigy.com
|
|
|
|
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
|
|
|
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
|
|
|
|
*
|
|
|
|
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
|
|
|
|
* this source code without explicit permission.
|
|
|
|
|
*
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
unit uCEFExtensionHandler;
|
2018-05-12 14:50:54 +02:00
|
|
|
|
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
{$MODE OBJFPC}{$H+}
|
|
|
|
|
{$ENDIF}
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
2018-11-22 15:02:21 +01:00
|
|
|
|
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
|
|
|
|
|
{$MINENUMSIZE 4}
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
{$I cef.inc}
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
|
|
|
|
|
|
|
|
|
type
|
2017-09-19 19:18:52 +02:00
|
|
|
|
TCefExtensionHandlerRef = class(TCefBaseRefCountedRef, ICefExtensionHandler)
|
|
|
|
|
protected
|
|
|
|
|
procedure OnExtensionLoadFailed(result: TCefErrorcode);
|
|
|
|
|
procedure OnExtensionLoaded(const extension: ICefExtension);
|
|
|
|
|
procedure OnExtensionUnloaded(const extension: ICefExtension);
|
2017-10-26 13:23:13 +02:00
|
|
|
|
function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean;
|
|
|
|
|
function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean;
|
|
|
|
|
function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser;
|
|
|
|
|
function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean;
|
|
|
|
|
function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
class function UnWrap(data: Pointer): ICefExtensionHandler;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
TCefExtensionHandlerOwn = class(TCefBaseRefCountedOwn, ICefExtensionHandler)
|
2017-09-19 19:18:52 +02:00
|
|
|
|
protected
|
|
|
|
|
procedure OnExtensionLoadFailed(result: TCefErrorcode); virtual;
|
|
|
|
|
procedure OnExtensionLoaded(const extension: ICefExtension); virtual;
|
|
|
|
|
procedure OnExtensionUnloaded(const extension: ICefExtension); virtual;
|
2017-10-26 13:23:13 +02:00
|
|
|
|
function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; virtual;
|
|
|
|
|
function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean;
|
|
|
|
|
function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; virtual;
|
|
|
|
|
function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; virtual;
|
|
|
|
|
function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; virtual;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
constructor Create; virtual;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFGetExtensionResourceCallback, uCEFExtension, uCEFBrowser, uCEFClient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
// ************************ TCefExtensionHandlerRef **************************
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
|
|
|
|
|
procedure TCefExtensionHandlerRef.OnExtensionLoadFailed(result: TCefErrorcode);
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
2017-09-19 19:18:52 +02:00
|
|
|
|
procedure TCefExtensionHandlerRef.OnExtensionLoaded(const extension: ICefExtension);
|
2018-03-29 20:02:04 +02:00
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
end;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
|
|
|
|
procedure TCefExtensionHandlerRef.OnExtensionUnloaded(const extension: ICefExtension);
|
2018-03-29 20:02:04 +02:00
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
end;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
|
|
|
|
function TCefExtensionHandlerRef.OnBeforeBackgroundBrowser(const extension : ICefExtension;
|
|
|
|
|
const url : ustring;
|
|
|
|
|
var client : ICefClient;
|
|
|
|
|
var settings : TCefBrowserSettings) : boolean;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
end;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
2017-10-26 13:23:13 +02:00
|
|
|
|
function TCefExtensionHandlerRef.OnBeforeBrowser(const extension : ICefExtension;
|
|
|
|
|
const browser : ICefBrowser;
|
|
|
|
|
const active_browser : ICefBrowser;
|
|
|
|
|
index : Integer;
|
|
|
|
|
const url : ustring;
|
|
|
|
|
active : boolean;
|
|
|
|
|
var windowInfo : TCefWindowInfo;
|
|
|
|
|
var client : ICefClient;
|
|
|
|
|
var settings : TCefBrowserSettings) : boolean;
|
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := True;
|
2017-10-26 13:23:13 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2017-09-19 19:18:52 +02:00
|
|
|
|
function TCefExtensionHandlerRef.GetActiveBrowser(const extension : ICefExtension;
|
|
|
|
|
const browser : ICefBrowser;
|
|
|
|
|
include_incognito : boolean): ICefBrowser;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
|
Result := TCefBrowserRef.UnWrap(PCefExtensionHandler(FData)^.get_active_browser(PCefExtensionHandler(FData),
|
|
|
|
|
CefGetData(extension),
|
|
|
|
|
CefGetData(browser),
|
|
|
|
|
Ord(include_incognito)));
|
2018-03-29 20:02:04 +02:00
|
|
|
|
end;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
|
|
|
|
function TCefExtensionHandlerRef.CanAccessBrowser(const extension : ICefExtension;
|
|
|
|
|
const browser : ICefBrowser;
|
|
|
|
|
include_incognito : boolean;
|
|
|
|
|
const target_browser : ICefBrowser): boolean;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
|
Result := PCefExtensionHandler(FData)^.can_access_browser(PCefExtensionHandler(FData),
|
|
|
|
|
CefGetData(extension),
|
|
|
|
|
CefGetData(browser),
|
|
|
|
|
Ord(include_incognito),
|
|
|
|
|
CefGetData(target_browser)) <> 0;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
end;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
|
|
|
|
function TCefExtensionHandlerRef.GetExtensionResource(const extension : ICefExtension;
|
|
|
|
|
const browser : ICefBrowser;
|
|
|
|
|
const file_ : ustring;
|
|
|
|
|
const callback : ICefGetExtensionResourceCallback): boolean;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempFile : TCefString;
|
|
|
|
|
begin
|
|
|
|
|
TempFile := CefString(file_);
|
2018-05-12 14:50:54 +02:00
|
|
|
|
Result := PCefExtensionHandler(FData)^.get_extension_resource(PCefExtensionHandler(FData),
|
|
|
|
|
CefGetData(extension),
|
|
|
|
|
CefGetData(browser),
|
|
|
|
|
@TempFile,
|
|
|
|
|
CefGetData(callback)) <> 0;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
class function TCefExtensionHandlerRef.UnWrap(data: Pointer): ICefExtensionHandler;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
begin
|
|
|
|
|
if (data <> nil) then
|
|
|
|
|
Result := Create(data) as ICefExtensionHandler
|
|
|
|
|
else
|
|
|
|
|
Result := nil;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
// ************************ TCefExtensionHandlerOwn **************************
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
|
|
|
|
|
procedure cef_extension_handler_on_extension_load_failed(self : PCefExtensionHandler;
|
|
|
|
|
result : TCefErrorcode); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then
|
|
|
|
|
TCefExtensionHandlerOwn(TempObject).OnExtensionLoadFailed(result);
|
|
|
|
|
end;
|
|
|
|
|
|
2017-09-19 19:18:52 +02:00
|
|
|
|
procedure cef_extension_handler_on_extension_loaded(self : PCefExtensionHandler;
|
|
|
|
|
extension : PCefExtension); stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then
|
|
|
|
|
TCefExtensionHandlerOwn(TempObject).OnExtensionLoaded(TCefExtensionRef.UnWrap(extension));
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure cef_extension_handler_on_extension_unloaded(self : PCefExtensionHandler;
|
|
|
|
|
extension : PCefExtension); stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then
|
|
|
|
|
TCefExtensionHandlerOwn(TempObject).OnExtensionUnloaded(TCefExtensionRef.UnWrap(extension));
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
function cef_extension_handler_on_before_background_browser( self : PCefExtensionHandler;
|
|
|
|
|
extension : PCefExtension;
|
|
|
|
|
const url : PCefString;
|
|
|
|
|
var client : PCefClient;
|
|
|
|
|
settings : PCefBrowserSettings) : Integer; stdcall;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
var
|
|
|
|
|
TempClient : ICefClient;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject : TObject;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
try
|
|
|
|
|
Result := Ord(True);
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
TempClient := TCefClientRef.UnWrap(client);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then
|
|
|
|
|
Result := Ord(TCefExtensionHandlerOwn(TempObject).OnBeforeBackgroundBrowser(TCefExtensionRef.UnWrap(extension),
|
|
|
|
|
CefString(url),
|
|
|
|
|
TempClient,
|
|
|
|
|
settings^));
|
|
|
|
|
|
|
|
|
|
if (TempClient = nil) then
|
|
|
|
|
client := nil
|
|
|
|
|
else
|
|
|
|
|
if not(TempClient.SameAs(client)) then
|
|
|
|
|
client := TempClient.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempClient := nil;
|
|
|
|
|
end;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
function cef_extension_handler_on_before_browser( self : PCefExtensionHandler;
|
|
|
|
|
extension : PCefExtension;
|
|
|
|
|
browser : PCefBrowser;
|
|
|
|
|
active_browser : PCefBrowser;
|
|
|
|
|
index : Integer;
|
|
|
|
|
const url : PCefString;
|
|
|
|
|
active : Integer;
|
|
|
|
|
windowInfo : PCefWindowInfo;
|
|
|
|
|
var client : PCefClient;
|
|
|
|
|
settings : PCefBrowserSettings) : Integer; stdcall;
|
2017-10-26 13:23:13 +02:00
|
|
|
|
var
|
|
|
|
|
TempClient : ICefClient;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject : TObject;
|
2017-10-26 13:23:13 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
try
|
|
|
|
|
Result := Ord(True);
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
TempClient := TCefClientRef.UnWrap(client);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then
|
|
|
|
|
Result := Ord(TCefExtensionHandlerOwn(TempObject).OnBeforeBrowser(TCefExtensionRef.UnWrap(extension),
|
|
|
|
|
TCefBrowserRef.UnWrap(browser),
|
|
|
|
|
TCefBrowserRef.UnWrap(active_browser),
|
|
|
|
|
index,
|
|
|
|
|
CefString(url),
|
|
|
|
|
active <> 0,
|
|
|
|
|
windowInfo^,
|
|
|
|
|
TempClient,
|
|
|
|
|
settings^));
|
|
|
|
|
|
|
|
|
|
if (TempClient = nil) then
|
|
|
|
|
client := nil
|
|
|
|
|
else
|
|
|
|
|
if not(TempClient.SameAs(client)) then
|
|
|
|
|
client := TempClient.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempClient := nil;
|
|
|
|
|
end;
|
2017-10-26 13:23:13 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2017-09-19 19:18:52 +02:00
|
|
|
|
function cef_extension_handler_get_active_browser(self : PCefExtensionHandler;
|
|
|
|
|
extension : PCefExtension;
|
|
|
|
|
browser : PCefBrowser;
|
|
|
|
|
include_incognito : Integer): PCefBrowser; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then
|
|
|
|
|
Result := CefGetData(TCefExtensionHandlerOwn(TempObject).GetActiveBrowser(TCefExtensionRef.UnWrap(extension),
|
|
|
|
|
TCefBrowserRef.UnWrap(browser),
|
|
|
|
|
include_incognito <> 0));
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function cef_extension_handler_can_access_browser(self : PCefExtensionHandler;
|
|
|
|
|
extension : PCefExtension;
|
|
|
|
|
browser : PCefBrowser;
|
|
|
|
|
include_incognito : Integer;
|
|
|
|
|
target_browser : PCefBrowser): Integer; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := Ord(True);
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then
|
|
|
|
|
Result := Ord(TCefExtensionHandlerOwn(TempObject).CanAccessBrowser(TCefExtensionRef.UnWrap(extension),
|
|
|
|
|
TCefBrowserRef.UnWrap(browser),
|
|
|
|
|
include_incognito <> 0,
|
|
|
|
|
TCefBrowserRef.UnWrap(target_browser)));
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
function cef_extension_handler_get_extension_resource( self : PCefExtensionHandler;
|
|
|
|
|
extension : PCefExtension;
|
|
|
|
|
browser : PCefBrowser;
|
|
|
|
|
const file_ : PCefString;
|
|
|
|
|
callback : PCefGetExtensionResourceCallback): Integer; stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := Ord(False);
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then
|
|
|
|
|
Result := Ord(TCefExtensionHandlerOwn(TempObject).GetExtensionResource(TCefExtensionRef.UnWrap(extension),
|
|
|
|
|
TCefBrowserRef.UnWrap(browser),
|
|
|
|
|
CefString(file_),
|
|
|
|
|
TCefGetExtensionResourceCallbackRef.UnWrap(callback)));
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
|
|
|
|
|
constructor TCefExtensionHandlerOwn.Create;
|
|
|
|
|
begin
|
|
|
|
|
inherited CreateData(SizeOf(TCefExtensionHandler));
|
2017-09-19 19:18:52 +02:00
|
|
|
|
|
|
|
|
|
with PCefExtensionHandler(FData)^ do
|
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
|
on_extension_load_failed := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_on_extension_load_failed;
|
|
|
|
|
on_extension_loaded := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_on_extension_loaded;
|
|
|
|
|
on_extension_unloaded := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_on_extension_unloaded;
|
|
|
|
|
on_before_background_browser := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_on_before_background_browser;
|
|
|
|
|
on_before_browser := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_on_before_browser;
|
|
|
|
|
get_active_browser := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_get_active_browser;
|
|
|
|
|
can_access_browser := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_can_access_browser;
|
|
|
|
|
get_extension_resource := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_get_extension_resource;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefExtensionHandlerOwn.OnExtensionLoadFailed(result: TCefErrorcode);
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
2017-09-19 19:18:52 +02:00
|
|
|
|
procedure TCefExtensionHandlerOwn.OnExtensionLoaded(const extension: ICefExtension);
|
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefExtensionHandlerOwn.OnExtensionUnloaded(const extension: ICefExtension);
|
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefExtensionHandlerOwn.OnBeforeBackgroundBrowser(const extension : ICefExtension;
|
|
|
|
|
const url : ustring;
|
|
|
|
|
var client : ICefClient;
|
|
|
|
|
var settings : TCefBrowserSettings) : boolean;
|
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := True;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2017-10-26 13:23:13 +02:00
|
|
|
|
function TCefExtensionHandlerOwn.OnBeforeBrowser(const extension : ICefExtension;
|
|
|
|
|
const browser : ICefBrowser;
|
|
|
|
|
const active_browser : ICefBrowser;
|
|
|
|
|
index : Integer;
|
|
|
|
|
const url : ustring;
|
|
|
|
|
active : boolean;
|
|
|
|
|
var windowInfo : TCefWindowInfo;
|
|
|
|
|
var client : ICefClient;
|
|
|
|
|
var settings : TCefBrowserSettings) : boolean;
|
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := True;
|
2017-10-26 13:23:13 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2017-09-19 19:18:52 +02:00
|
|
|
|
function TCefExtensionHandlerOwn.GetActiveBrowser(const extension : ICefExtension;
|
|
|
|
|
const browser : ICefBrowser;
|
|
|
|
|
include_incognito : boolean): ICefBrowser;
|
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := nil;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefExtensionHandlerOwn.CanAccessBrowser(const extension : ICefExtension;
|
|
|
|
|
const browser : ICefBrowser;
|
|
|
|
|
include_incognito : boolean;
|
|
|
|
|
const target_browser : ICefBrowser): boolean;
|
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := True;
|
2017-09-19 19:18:52 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefExtensionHandlerOwn.GetExtensionResource(const extension : ICefExtension;
|
|
|
|
|
const browser : ICefBrowser;
|
|
|
|
|
const file_ : ustring;
|
|
|
|
|
const callback : ICefGetExtensionResourceCallback): boolean;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|