mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
Update to CEF 77.1.12
- Added TChromium.PrintingEnabled property - Added TChromium.ClearCertificateExceptions function - Added TChromium.ClearHttpAuthCredentialsfunction - Added TChromium.CloseAllConnections function - Added TChromium.OnCertificateExceptionsCleared event - Added TChromium.OnHttpAuthCredentialsCleared event - Added TChromium.OnAllConnectionsClosed event
This commit is contained in:
parent
00552ef117
commit
1dc18e6aa6
@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador D
|
||||
|
||||
CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
|
||||
|
||||
CEF4Delphi uses CEF 77.1.11 which includes Chromium 77.0.3865.90.
|
||||
CEF4Delphi uses CEF 77.1.12 which includes Chromium 77.0.3865.90.
|
||||
The CEF binaries used by CEF4Delphi are available for download at spotify :
|
||||
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_77.1.11%2Bg1687a63%2Bchromium-77.0.3865.90_windows32.tar.bz2)
|
||||
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_77.1.11%2Bg1687a63%2Bchromium-77.0.3865.90_windows64.tar.bz2)
|
||||
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_77.1.12%2Bgc63c001%2Bchromium-77.0.3865.90_windows32.tar.bz2)
|
||||
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_77.1.12%2Bgc63c001%2Bchromium-77.0.3865.90_windows64.tar.bz2)
|
||||
|
||||
|
||||
CEF4Delphi was developed and tested on Delphi 10.3 Rio and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2 and Lazarus 2.0.4/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
||||
|
@ -21,7 +21,7 @@
|
||||
</CompilerOptions>
|
||||
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
|
||||
<License Value="MPL 1.1"/>
|
||||
<Version Major="77" Minor="1" Release="11"/>
|
||||
<Version Major="77" Minor="1" Release="12"/>
|
||||
<Files Count="142">
|
||||
<Item1>
|
||||
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
|
||||
|
@ -62,7 +62,7 @@ uses
|
||||
const
|
||||
CEF_SUPPORTED_VERSION_MAJOR = 77;
|
||||
CEF_SUPPORTED_VERSION_MINOR = 1;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 11;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 12;
|
||||
CEF_SUPPORTED_VERSION_BUILD = 0;
|
||||
|
||||
CEF_CHROMEELF_VERSION_MAJOR = 77;
|
||||
|
@ -107,6 +107,7 @@ type
|
||||
FClosing : boolean;
|
||||
FSafeSearch : boolean;
|
||||
FYouTubeRestrict : integer;
|
||||
FPrintingEnabled : boolean;
|
||||
FWindowInfo : TCefWindowInfo;
|
||||
FBrowserSettings : TCefBrowserSettings;
|
||||
FDevWindowInfo : TCefWindowInfo;
|
||||
@ -245,6 +246,9 @@ type
|
||||
FOnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent;
|
||||
FOnDownloadImageFinished : TOnDownloadImageFinishedEvent;
|
||||
FOnCookiesFlushed : TNotifyEvent;
|
||||
FOnCertificateExceptionsCleared : TNotifyEvent;
|
||||
FOnHttpAuthCredentialsCleared : TNotifyEvent;
|
||||
FOnAllConnectionsClosed : TNotifyEvent;
|
||||
{$IFNDEF FPC}
|
||||
FOnBrowserCompMsg : TOnCompMsgEvent;
|
||||
FOnWidgetCompMsg : TOnCompMsgEvent;
|
||||
@ -306,6 +310,7 @@ type
|
||||
procedure SetAudioMuted(aValue : boolean);
|
||||
procedure SetSafeSearch(aValue : boolean);
|
||||
procedure SetYouTubeRestrict(aValue : integer);
|
||||
procedure SetPrintingEnabled(aValue : boolean);
|
||||
|
||||
|
||||
function CreateBrowserHost(aWindowInfo : PCefWindowInfo; const aURL : ustring; const aSettings : PCefBrowserSettings; const aExtraInfo : ICefDictionaryValue; const aContext : ICefRequestContext): boolean;
|
||||
@ -484,6 +489,9 @@ type
|
||||
function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean; virtual;
|
||||
procedure doDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage); virtual;
|
||||
procedure doOnCookiesStoreFlushed; virtual;
|
||||
procedure doCertificateExceptionsCleared; virtual;
|
||||
procedure doHttpAuthCredentialsCleared; virtual;
|
||||
procedure doAllConnectionsClosed; virtual;
|
||||
function MustCreateLoadHandler : boolean; virtual;
|
||||
function MustCreateFocusHandler : boolean; virtual;
|
||||
function MustCreateContextMenuHandler : boolean; virtual;
|
||||
@ -532,6 +540,9 @@ type
|
||||
procedure SimulateMouseWheel(aDeltaX, aDeltaY : integer);
|
||||
function DeleteCookies(const url : ustring = ''; const cookieName : ustring = '') : boolean;
|
||||
function FlushCookieStore(aFlushImmediately : boolean = True) : boolean;
|
||||
function ClearCertificateExceptions(aClearImmediately : boolean = True) : boolean;
|
||||
function ClearHttpAuthCredentials(aClearImmediately : boolean = True) : boolean;
|
||||
function CloseAllConnections(aCloseImmediately : boolean = True) : boolean;
|
||||
procedure RetrieveHTML(const aFrameName : ustring = ''); overload;
|
||||
procedure RetrieveHTML(const aFrame : ICefFrame); overload;
|
||||
procedure RetrieveHTML(const aFrameIdentifier : int64); overload;
|
||||
@ -668,6 +679,7 @@ type
|
||||
property AudioMuted : boolean read GetAudioMuted write SetAudioMuted;
|
||||
property SafeSearch : boolean read FSafeSearch write SetSafeSearch;
|
||||
property YouTubeRestrict : integer read FYouTubeRestrict write SetYouTubeRestrict;
|
||||
property PrintingEnabled : boolean read FPrintingEnabled write SetPrintingEnabled;
|
||||
|
||||
property WebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy read FWebRTCIPHandlingPolicy write SetWebRTCIPHandlingPolicy;
|
||||
property WebRTCMultipleRoutes : TCefState read FWebRTCMultipleRoutes write SetWebRTCMultipleRoutes;
|
||||
@ -692,6 +704,9 @@ type
|
||||
property OnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent read FOnNavigationVisitorResultAvailable write FOnNavigationVisitorResultAvailable;
|
||||
property OnDownloadImageFinished : TOnDownloadImageFinishedEvent read FOnDownloadImageFinished write FOnDownloadImageFinished;
|
||||
property OnCookiesFlushed : TNotifyEvent read FOnCookiesFlushed write FOnCookiesFlushed;
|
||||
property OnCertificateExceptionsCleared : TNotifyEvent read FOnCertificateExceptionsCleared write FOnCertificateExceptionsCleared;
|
||||
property OnHttpAuthCredentialsCleared : TNotifyEvent read FOnHttpAuthCredentialsCleared write FOnHttpAuthCredentialsCleared;
|
||||
property OnAllConnectionsClosed : TNotifyEvent read FOnAllConnectionsClosed write FOnAllConnectionsClosed;
|
||||
{$IFNDEF FPC}
|
||||
property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg;
|
||||
property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg;
|
||||
@ -852,6 +867,7 @@ begin
|
||||
FZoomStep := ZOOM_STEP_DEF;
|
||||
FSafeSearch := False;
|
||||
FYouTubeRestrict := YOUTUBE_RESTRICT_OFF;
|
||||
FPrintingEnabled := True;
|
||||
|
||||
{$IFNDEF FPC}
|
||||
FOldBrowserCompWndPrc := nil;
|
||||
@ -1163,6 +1179,9 @@ begin
|
||||
FOnNavigationVisitorResultAvailable := nil;
|
||||
FOnDownloadImageFinished := nil;
|
||||
FOnCookiesFlushed := nil;
|
||||
FOnCertificateExceptionsCleared := nil;
|
||||
FOnHttpAuthCredentialsCleared := nil;
|
||||
FOnAllConnectionsClosed := nil;
|
||||
{$IFNDEF FPC}
|
||||
FOnBrowserCompMsg := nil;
|
||||
FOnWidgetCompMsg := nil;
|
||||
@ -2059,6 +2078,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TChromium.SetPrintingEnabled(aValue : boolean);
|
||||
begin
|
||||
if (FPrintingEnabled <> aValue) then
|
||||
begin
|
||||
FPrintingEnabled := aValue;
|
||||
FUpdatePreferences := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TChromium.SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy);
|
||||
begin
|
||||
if (FWebRTCIPHandlingPolicy <> aValue) then
|
||||
@ -2225,7 +2253,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TChromium.FlushCookieStore(aFlushImmediately : boolean = True) : boolean;
|
||||
// If aFlushImmediately is false then OnCookiesFlushed is triggered when the cookies are flushed
|
||||
function TChromium.FlushCookieStore(aFlushImmediately : boolean) : boolean;
|
||||
var
|
||||
TempManager : ICefCookieManager;
|
||||
TempCallback : ICefCompletionCallback;
|
||||
@ -2250,6 +2279,69 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// If aClearImmediately is false then OnCertificateExceptionsCleared is triggered when the exceptions are cleared
|
||||
function TChromium.ClearCertificateExceptions(aClearImmediately : boolean) : boolean;
|
||||
var
|
||||
TempCallback : ICefCompletionCallback;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if Initialized and (FBrowser.Host <> nil) and (FBrowser.Host.RequestContext <> nil) then
|
||||
try
|
||||
if aClearImmediately then
|
||||
TempCallback := nil
|
||||
else
|
||||
TempCallback := TCefClearCertificateExceptionsCompletionCallback.Create(self);
|
||||
|
||||
FBrowser.Host.RequestContext.ClearCertificateExceptions(TempCallback);
|
||||
Result := True;
|
||||
finally
|
||||
TempCallback := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// If aClearImmediately is false then OnHttpAuthCredentialsCleared is triggered when the credeintials are cleared
|
||||
function TChromium.ClearHttpAuthCredentials(aClearImmediately : boolean) : boolean;
|
||||
var
|
||||
TempCallback : ICefCompletionCallback;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if Initialized and (FBrowser.Host <> nil) and (FBrowser.Host.RequestContext <> nil) then
|
||||
try
|
||||
if aClearImmediately then
|
||||
TempCallback := nil
|
||||
else
|
||||
TempCallback := TCefClearHttpAuthCredentialsCompletionCallback.Create(self);
|
||||
|
||||
FBrowser.Host.RequestContext.ClearHttpAuthCredentials(TempCallback);
|
||||
Result := True;
|
||||
finally
|
||||
TempCallback := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// If aCloseImmediately is false then OnAllConnectionsClosed is triggered when the connections are closed
|
||||
function TChromium.CloseAllConnections(aCloseImmediately : boolean) : boolean;
|
||||
var
|
||||
TempCallback : ICefCompletionCallback;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if Initialized and (FBrowser.Host <> nil) and (FBrowser.Host.RequestContext <> nil) then
|
||||
try
|
||||
if aCloseImmediately then
|
||||
TempCallback := nil
|
||||
else
|
||||
TempCallback := TCefCloseAllConnectionsCompletionCallback.Create(self);
|
||||
|
||||
FBrowser.Host.RequestContext.CloseAllConnections(TempCallback);
|
||||
Result := True;
|
||||
finally
|
||||
TempCallback := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// Leave aFrameName empty to get the HTML source from the main frame
|
||||
procedure TChromium.RetrieveHTML(const aFrameName : ustring);
|
||||
var
|
||||
@ -2503,6 +2595,9 @@ procedure TChromium.doUpdatePreferences(const aBrowser: ICefBrowser);
|
||||
begin
|
||||
FUpdatePreferences := False;
|
||||
|
||||
// The preferences registered in CEF are defined in :
|
||||
// /libcef/browser/prefs/browser_prefs.cc
|
||||
|
||||
UpdateProxyPrefs(aBrowser);
|
||||
UpdatePreference(aBrowser, 'enable_do_not_track', FDoNotTrack);
|
||||
UpdatePreference(aBrowser, 'enable_referrers', FSendReferrer);
|
||||
@ -2514,6 +2609,7 @@ begin
|
||||
UpdateStringListPref(aBrowser, 'spellcheck.dictionaries', FSpellCheckerDicts);
|
||||
UpdatePreference(aBrowser, 'settings.force_google_safesearch', FSafeSearch);
|
||||
UpdatePreference(aBrowser, 'settings.force_youtube_restrict', FYouTubeRestrict);
|
||||
UpdatePreference(aBrowser, 'printing.enabled', FPrintingEnabled);
|
||||
|
||||
if (FMaxConnectionsPerProxy <> CEF_MAX_CONNECTIONS_PER_PROXY_DEFAULT_VALUE) then
|
||||
UpdatePreference(aBrowser, 'net.max_connections_per_proxy', FMaxConnectionsPerProxy);
|
||||
@ -2554,64 +2650,70 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference('proxy') then
|
||||
begin
|
||||
TempProxy := TCefValueRef.New;
|
||||
TempValue := TCefValueRef.New;
|
||||
TempDict := TCefDictionaryValueRef.New;
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference('proxy') then
|
||||
begin
|
||||
TempProxy := TCefValueRef.New;
|
||||
TempValue := TCefValueRef.New;
|
||||
TempDict := TCefDictionaryValueRef.New;
|
||||
|
||||
case FProxyType of
|
||||
CEF_PROXYTYPE_AUTODETECT :
|
||||
begin
|
||||
TempValue.SetString('auto_detect');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
|
||||
CEF_PROXYTYPE_SYSTEM :
|
||||
begin
|
||||
TempValue.SetString('system');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
|
||||
CEF_PROXYTYPE_FIXED_SERVERS :
|
||||
begin
|
||||
TempValue.SetString('fixed_servers');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
|
||||
case FProxyScheme of
|
||||
psSOCKS4 : TempDict.SetString('server', 'socks4://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||
psSOCKS5 : TempDict.SetString('server', 'socks5://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||
else TempDict.SetString('server', FProxyServer + ':' + inttostr(FProxyPort));
|
||||
case FProxyType of
|
||||
CEF_PROXYTYPE_AUTODETECT :
|
||||
begin
|
||||
TempValue.SetString('auto_detect');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
|
||||
if (length(FProxyByPassList) > 0) then TempDict.SetString('bypass_list', FProxyByPassList);
|
||||
end;
|
||||
CEF_PROXYTYPE_SYSTEM :
|
||||
begin
|
||||
TempValue.SetString('system');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
|
||||
CEF_PROXYTYPE_PAC_SCRIPT :
|
||||
begin
|
||||
TempValue.SetString('pac_script');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
TempDict.SetString('pac_url', FProxyScriptURL);
|
||||
end;
|
||||
CEF_PROXYTYPE_FIXED_SERVERS :
|
||||
begin
|
||||
TempValue.SetString('fixed_servers');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
|
||||
else // CEF_PROXYTYPE_DIRECT
|
||||
begin
|
||||
TempValue.SetString('direct');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
case FProxyScheme of
|
||||
psSOCKS4 : TempDict.SetString('server', 'socks4://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||
psSOCKS5 : TempDict.SetString('server', 'socks5://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||
else TempDict.SetString('server', FProxyServer + ':' + inttostr(FProxyPort));
|
||||
end;
|
||||
|
||||
if (length(FProxyByPassList) > 0) then TempDict.SetString('bypass_list', FProxyByPassList);
|
||||
end;
|
||||
|
||||
CEF_PROXYTYPE_PAC_SCRIPT :
|
||||
begin
|
||||
TempValue.SetString('pac_script');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
TempDict.SetString('pac_url', FProxyScriptURL);
|
||||
end;
|
||||
|
||||
else // CEF_PROXYTYPE_DIRECT
|
||||
begin
|
||||
TempValue.SetString('direct');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
Result := TempProxy.SetDictionary(TempDict) and
|
||||
aBrowser.Host.RequestContext.SetPreference('proxy', TempProxy, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdateProxyPrefs error : ' + quotedstr(TempError));
|
||||
end;
|
||||
|
||||
Result := TempProxy.SetDictionary(TempDict) and
|
||||
aBrowser.Host.RequestContext.SetPreference('proxy', TempProxy, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdateProxyPrefs error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdateProxyPrefs', e) then raise;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdateProxyPrefs', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempProxy := nil;
|
||||
TempValue := nil;
|
||||
TempDict := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2623,25 +2725,29 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
|
||||
if aValue then
|
||||
TempValue.SetBool(1)
|
||||
else
|
||||
TempValue.SetBool(0);
|
||||
if aValue then
|
||||
TempValue.SetBool(1)
|
||||
else
|
||||
TempValue.SetBool(0);
|
||||
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2653,20 +2759,24 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetInt(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetInt(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2678,20 +2788,24 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetDouble(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetDouble(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
Tempvalue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2703,20 +2817,24 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetString(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetString(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2731,35 +2849,40 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aValue <> nil) and
|
||||
(aValue.Count > 0) and
|
||||
(aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempSize := aValue.Count;
|
||||
TempList := TCefListValueRef.New;
|
||||
try
|
||||
if (aValue <> nil) and
|
||||
(aValue.Count > 0) and
|
||||
(aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempSize := aValue.Count;
|
||||
TempList := TCefListValueRef.New;
|
||||
|
||||
if TempList.SetSize(TempSize) then
|
||||
begin
|
||||
i := 0;
|
||||
while (i < TempSize) do
|
||||
begin
|
||||
TempList.SetString(i, aValue[i]);
|
||||
inc(i);
|
||||
end;
|
||||
if TempList.SetSize(TempSize) then
|
||||
begin
|
||||
i := 0;
|
||||
while (i < TempSize) do
|
||||
begin
|
||||
TempList.SetString(i, aValue[i]);
|
||||
inc(i);
|
||||
end;
|
||||
|
||||
TempValue := TCefValueRef.New;
|
||||
Result := TempValue.SetList(TempList) and
|
||||
aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
TempValue := TCefValueRef.New;
|
||||
Result := TempValue.SetList(TempList) and
|
||||
aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
TempList := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3068,6 +3191,21 @@ begin
|
||||
if assigned(FOnCookiesFlushed) then FOnCookiesFlushed(self);
|
||||
end;
|
||||
|
||||
procedure TChromium.doCertificateExceptionsCleared;
|
||||
begin
|
||||
if assigned(FOnCertificateExceptionsCleared) then FOnCertificateExceptionsCleared(self);
|
||||
end;
|
||||
|
||||
procedure TChromium.doHttpAuthCredentialsCleared;
|
||||
begin
|
||||
if assigned(FOnHttpAuthCredentialsCleared) then FOnHttpAuthCredentialsCleared(self);
|
||||
end;
|
||||
|
||||
procedure TChromium.doAllConnectionsClosed;
|
||||
begin
|
||||
if assigned(FOnAllConnectionsClosed) then FOnAllConnectionsClosed(self);
|
||||
end;
|
||||
|
||||
function TChromium.MustCreateLoadHandler : boolean;
|
||||
begin
|
||||
Result := assigned(FOnLoadStart) or
|
||||
|
@ -96,6 +96,7 @@ type
|
||||
FClosing : boolean;
|
||||
FSafeSearch : boolean;
|
||||
FYouTubeRestrict : integer;
|
||||
FPrintingEnabled : boolean;
|
||||
FWindowInfo : TCefWindowInfo;
|
||||
FBrowserSettings : TCefBrowserSettings;
|
||||
FDevWindowInfo : TCefWindowInfo;
|
||||
@ -228,6 +229,9 @@ type
|
||||
FOnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent;
|
||||
FOnDownloadImageFinished : TOnDownloadImageFinishedEvent;
|
||||
FOnCookiesFlushed : TNotifyEvent;
|
||||
FOnCertificateExceptionsCleared : TNotifyEvent;
|
||||
FOnHttpAuthCredentialsCleared : TNotifyEvent;
|
||||
FOnAllConnectionsClosed : TNotifyEvent;
|
||||
{$IFDEF MSWINDOWS}
|
||||
FOnBrowserCompMsg : TOnCompMsgEvent;
|
||||
FOnWidgetCompMsg : TOnCompMsgEvent;
|
||||
@ -289,6 +293,7 @@ type
|
||||
procedure SetAudioMuted(aValue : boolean);
|
||||
procedure SetSafeSearch(aValue : boolean);
|
||||
procedure SetYouTubeRestrict(aValue : integer);
|
||||
procedure SetPrintingEnabled(aValue : boolean);
|
||||
|
||||
|
||||
function CreateBrowserHost(aWindowInfo : PCefWindowInfo; const aURL : ustring; const aSettings : PCefBrowserSettings; const aExtraInfo : ICefDictionaryValue; const aContext : ICefRequestContext): boolean;
|
||||
@ -451,6 +456,9 @@ type
|
||||
function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean; virtual;
|
||||
procedure doDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage); virtual;
|
||||
procedure doOnCookiesStoreFlushed; virtual;
|
||||
procedure doCertificateExceptionsCleared; virtual;
|
||||
procedure doHttpAuthCredentialsCleared; virtual;
|
||||
procedure doAllConnectionsClosed; virtual;
|
||||
function MustCreateLoadHandler : boolean; virtual;
|
||||
function MustCreateFocusHandler : boolean; virtual;
|
||||
function MustCreateContextMenuHandler : boolean; virtual;
|
||||
@ -499,6 +507,9 @@ type
|
||||
procedure SimulateMouseWheel(aDeltaX, aDeltaY : integer);
|
||||
function DeleteCookies(const url : ustring = ''; const cookieName : ustring = '') : boolean;
|
||||
function FlushCookieStore(aFlushImmediately : boolean = True) : boolean;
|
||||
function ClearCertificateExceptions(aClearImmediately : boolean = True) : boolean;
|
||||
function ClearHttpAuthCredentials(aClearImmediately : boolean = True) : boolean;
|
||||
function CloseAllConnections(aCloseImmediately : boolean = True) : boolean;
|
||||
procedure RetrieveHTML(const aFrameName : ustring = ''); overload;
|
||||
procedure RetrieveHTML(const aFrame : ICefFrame); overload;
|
||||
procedure RetrieveHTML(const aFrameIdentifier : int64); overload;
|
||||
@ -628,6 +639,7 @@ type
|
||||
property AudioMuted : boolean read GetAudioMuted write SetAudioMuted;
|
||||
property SafeSearch : boolean read FSafeSearch write SetSafeSearch;
|
||||
property YouTubeRestrict : integer read FYouTubeRestrict write SetYouTubeRestrict;
|
||||
property PrintingEnabled : boolean read FPrintingEnabled write SetPrintingEnabled;
|
||||
|
||||
property WebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy read FWebRTCIPHandlingPolicy write SetWebRTCIPHandlingPolicy;
|
||||
property WebRTCMultipleRoutes : TCefState read FWebRTCMultipleRoutes write SetWebRTCMultipleRoutes;
|
||||
@ -651,6 +663,9 @@ type
|
||||
property OnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent read FOnNavigationVisitorResultAvailable write FOnNavigationVisitorResultAvailable;
|
||||
property OnDownloadImageFinishedEvent : TOnDownloadImageFinishedEvent read FOnDownloadImageFinished write FOnDownloadImageFinished;
|
||||
property OnCookiesFlushed : TNotifyEvent read FOnCookiesFlushed write FOnCookiesFlushed;
|
||||
property OnCertificateExceptionsCleared : TNotifyEvent read FOnCertificateExceptionsCleared write FOnCertificateExceptionsCleared;
|
||||
property OnHttpAuthCredentialsCleared : TNotifyEvent read FOnHttpAuthCredentialsCleared write FOnHttpAuthCredentialsCleared;
|
||||
property OnAllConnectionsClosed : TNotifyEvent read FOnAllConnectionsClosed write FOnAllConnectionsClosed;
|
||||
{$IFDEF MSWINDOWS}
|
||||
property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg;
|
||||
property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg;
|
||||
@ -1066,6 +1081,9 @@ begin
|
||||
FOnNavigationVisitorResultAvailable := nil;
|
||||
FOnDownloadImageFinished := nil;
|
||||
FOnCookiesFlushed := nil;
|
||||
FOnCertificateExceptionsCleared := nil;
|
||||
FOnHttpAuthCredentialsCleared := nil;
|
||||
FOnAllConnectionsClosed := nil;
|
||||
end;
|
||||
|
||||
function TFMXChromium.CreateBrowser(const aWindowName : ustring;
|
||||
@ -1834,6 +1852,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFMXChromium.SetPrintingEnabled(aValue : boolean);
|
||||
begin
|
||||
if (FPrintingEnabled <> aValue) then
|
||||
begin
|
||||
FPrintingEnabled := aValue;
|
||||
FUpdatePreferences := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFMXChromium.SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy);
|
||||
begin
|
||||
if (FWebRTCIPHandlingPolicy <> aValue) then
|
||||
@ -2000,7 +2027,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFMXChromium.FlushCookieStore(aFlushImmediately : boolean = True) : boolean;
|
||||
// If aFlushImmediately is false then OnCookiesFlushed is triggered when the cookies are flushed
|
||||
function TFMXChromium.FlushCookieStore(aFlushImmediately : boolean) : boolean;
|
||||
var
|
||||
TempManager : ICefCookieManager;
|
||||
TempCallback : ICefCompletionCallback;
|
||||
@ -2025,6 +2053,69 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// If aClearImmediately is false then OnCertificateExceptionsCleared is triggered when the exceptions are cleared
|
||||
function TFMXChromium.ClearCertificateExceptions(aClearImmediately : boolean) : boolean;
|
||||
var
|
||||
TempCallback : ICefCompletionCallback;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if Initialized and (FBrowser.Host <> nil) and (FBrowser.Host.RequestContext <> nil) then
|
||||
try
|
||||
if aClearImmediately then
|
||||
TempCallback := nil
|
||||
else
|
||||
TempCallback := TCefClearCertificateExceptionsCompletionCallback.Create(self);
|
||||
|
||||
FBrowser.Host.RequestContext.ClearCertificateExceptions(TempCallback);
|
||||
Result := True;
|
||||
finally
|
||||
TempCallback := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// If aClearImmediately is false then OnHttpAuthCredentialsCleared is triggered when the credeintials are cleared
|
||||
function TFMXChromium.ClearHttpAuthCredentials(aClearImmediately : boolean) : boolean;
|
||||
var
|
||||
TempCallback : ICefCompletionCallback;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if Initialized and (FBrowser.Host <> nil) and (FBrowser.Host.RequestContext <> nil) then
|
||||
try
|
||||
if aClearImmediately then
|
||||
TempCallback := nil
|
||||
else
|
||||
TempCallback := TCefClearHttpAuthCredentialsCompletionCallback.Create(self);
|
||||
|
||||
FBrowser.Host.RequestContext.ClearHttpAuthCredentials(TempCallback);
|
||||
Result := True;
|
||||
finally
|
||||
TempCallback := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// If aCloseImmediately is false then OnAllConnectionsClosed is triggered when the connections are closed
|
||||
function TFMXChromium.CloseAllConnections(aCloseImmediately : boolean) : boolean;
|
||||
var
|
||||
TempCallback : ICefCompletionCallback;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if Initialized and (FBrowser.Host <> nil) and (FBrowser.Host.RequestContext <> nil) then
|
||||
try
|
||||
if aCloseImmediately then
|
||||
TempCallback := nil
|
||||
else
|
||||
TempCallback := TCefCloseAllConnectionsCompletionCallback.Create(self);
|
||||
|
||||
FBrowser.Host.RequestContext.CloseAllConnections(TempCallback);
|
||||
Result := True;
|
||||
finally
|
||||
TempCallback := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// Leave aFrameName empty to get the HTML source from the main frame
|
||||
procedure TFMXChromium.RetrieveHTML(const aFrameName : ustring);
|
||||
var
|
||||
@ -2227,6 +2318,9 @@ procedure TFMXChromium.doUpdatePreferences(const aBrowser: ICefBrowser);
|
||||
begin
|
||||
FUpdatePreferences := False;
|
||||
|
||||
// The preferences registered in CEF are defined in :
|
||||
// /libcef/browser/prefs/browser_prefs.cc
|
||||
|
||||
UpdateProxyPrefs(aBrowser);
|
||||
UpdatePreference(aBrowser, 'enable_do_not_track', FDoNotTrack);
|
||||
UpdatePreference(aBrowser, 'enable_referrers', FSendReferrer);
|
||||
@ -2238,6 +2332,7 @@ begin
|
||||
UpdateStringListPref(aBrowser, 'spellcheck.dictionaries', FSpellCheckerDicts);
|
||||
UpdatePreference(aBrowser, 'settings.force_google_safesearch', FSafeSearch);
|
||||
UpdatePreference(aBrowser, 'settings.force_youtube_restrict', FYouTubeRestrict);
|
||||
UpdatePreference(aBrowser, 'printing.enabled', FPrintingEnabled);
|
||||
|
||||
if FRunAllFlashInAllowMode then
|
||||
UpdatePreference(aBrowser, 'profile.default_content_setting_values.plugins', 1);
|
||||
@ -2275,64 +2370,70 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference('proxy') then
|
||||
begin
|
||||
TempProxy := TCefValueRef.New;
|
||||
TempValue := TCefValueRef.New;
|
||||
TempDict := TCefDictionaryValueRef.New;
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference('proxy') then
|
||||
begin
|
||||
TempProxy := TCefValueRef.New;
|
||||
TempValue := TCefValueRef.New;
|
||||
TempDict := TCefDictionaryValueRef.New;
|
||||
|
||||
case FProxyType of
|
||||
CEF_PROXYTYPE_AUTODETECT :
|
||||
begin
|
||||
TempValue.SetString('auto_detect');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
|
||||
CEF_PROXYTYPE_SYSTEM :
|
||||
begin
|
||||
TempValue.SetString('system');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
|
||||
CEF_PROXYTYPE_FIXED_SERVERS :
|
||||
begin
|
||||
TempValue.SetString('fixed_servers');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
|
||||
case FProxyScheme of
|
||||
psSOCKS4 : TempDict.SetString('server', 'socks4://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||
psSOCKS5 : TempDict.SetString('server', 'socks5://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||
else TempDict.SetString('server', FProxyServer + ':' + inttostr(FProxyPort));
|
||||
case FProxyType of
|
||||
CEF_PROXYTYPE_AUTODETECT :
|
||||
begin
|
||||
TempValue.SetString('auto_detect');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
|
||||
if (length(FProxyByPassList) > 0) then TempDict.SetString('bypass_list', FProxyByPassList);
|
||||
end;
|
||||
CEF_PROXYTYPE_SYSTEM :
|
||||
begin
|
||||
TempValue.SetString('system');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
|
||||
CEF_PROXYTYPE_PAC_SCRIPT :
|
||||
begin
|
||||
TempValue.SetString('pac_script');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
TempDict.SetString('pac_url', FProxyScriptURL);
|
||||
end;
|
||||
CEF_PROXYTYPE_FIXED_SERVERS :
|
||||
begin
|
||||
TempValue.SetString('fixed_servers');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
|
||||
else // CEF_PROXYTYPE_DIRECT
|
||||
begin
|
||||
TempValue.SetString('direct');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
case FProxyScheme of
|
||||
psSOCKS4 : TempDict.SetString('server', 'socks4://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||
psSOCKS5 : TempDict.SetString('server', 'socks5://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||
else TempDict.SetString('server', FProxyServer + ':' + inttostr(FProxyPort));
|
||||
end;
|
||||
|
||||
if (length(FProxyByPassList) > 0) then TempDict.SetString('bypass_list', FProxyByPassList);
|
||||
end;
|
||||
|
||||
CEF_PROXYTYPE_PAC_SCRIPT :
|
||||
begin
|
||||
TempValue.SetString('pac_script');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
TempDict.SetString('pac_url', FProxyScriptURL);
|
||||
end;
|
||||
|
||||
else // CEF_PROXYTYPE_DIRECT
|
||||
begin
|
||||
TempValue.SetString('direct');
|
||||
TempDict.SetValue('mode', TempValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
Result := TempProxy.SetDictionary(TempDict) and
|
||||
aBrowser.Host.RequestContext.SetPreference('proxy', TempProxy, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdateProxyPrefs error : ' + quotedstr(TempError));
|
||||
end;
|
||||
|
||||
Result := TempProxy.SetDictionary(TempDict) and
|
||||
aBrowser.Host.RequestContext.SetPreference('proxy', TempProxy, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdateProxyPrefs error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdateProxyPrefs', e) then raise;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdateProxyPrefs', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempProxy := nil;
|
||||
TempValue := nil;
|
||||
TempDict := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2344,25 +2445,29 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
|
||||
if aValue then
|
||||
TempValue.SetBool(1)
|
||||
else
|
||||
TempValue.SetBool(0);
|
||||
if aValue then
|
||||
TempValue.SetBool(1)
|
||||
else
|
||||
TempValue.SetBool(0);
|
||||
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2374,20 +2479,24 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetInt(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetInt(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2399,20 +2508,24 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetDouble(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetDouble(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2424,20 +2537,24 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetString(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
try
|
||||
if (aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
TempValue.SetString(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2452,35 +2569,40 @@ begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if (aValue <> nil) and
|
||||
(aValue.Count > 0) and
|
||||
(aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempSize := aValue.Count;
|
||||
TempList := TCefListValueRef.New;
|
||||
try
|
||||
if (aValue <> nil) and
|
||||
(aValue.Count > 0) and
|
||||
(aBrowser <> nil) and
|
||||
(aBrowser.Host <> nil) and
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempSize := aValue.Count;
|
||||
TempList := TCefListValueRef.New;
|
||||
|
||||
if TempList.SetSize(TempSize) then
|
||||
begin
|
||||
i := 0;
|
||||
while (i < TempSize) do
|
||||
begin
|
||||
TempList.SetString(i, aValue[i]);
|
||||
inc(i);
|
||||
end;
|
||||
if TempList.SetSize(TempSize) then
|
||||
begin
|
||||
i := 0;
|
||||
while (i < TempSize) do
|
||||
begin
|
||||
TempList.SetString(i, aValue[i]);
|
||||
inc(i);
|
||||
end;
|
||||
|
||||
TempValue := TCefValueRef.New;
|
||||
Result := TempValue.SetList(TempList) and
|
||||
aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
TempValue := TCefValueRef.New;
|
||||
Result := TempValue.SetList(TempList) and
|
||||
aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
if not(Result) then
|
||||
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
|
||||
end;
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
|
||||
end;
|
||||
finally
|
||||
TempValue := nil;
|
||||
TempList := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2786,6 +2908,21 @@ begin
|
||||
if assigned(FOnCookiesFlushed) then FOnCookiesFlushed(self);
|
||||
end;
|
||||
|
||||
procedure TFMXChromium.doCertificateExceptionsCleared;
|
||||
begin
|
||||
if assigned(FOnCertificateExceptionsCleared) then FOnCertificateExceptionsCleared(self);
|
||||
end;
|
||||
|
||||
procedure TFMXChromium.doHttpAuthCredentialsCleared;
|
||||
begin
|
||||
if assigned(FOnHttpAuthCredentialsCleared) then FOnHttpAuthCredentialsCleared(self);
|
||||
end;
|
||||
|
||||
procedure TFMXChromium.doAllConnectionsClosed;
|
||||
begin
|
||||
if assigned(FOnAllConnectionsClosed) then FOnAllConnectionsClosed(self);
|
||||
end;
|
||||
|
||||
function TFMXChromium.MustCreateLoadHandler : boolean;
|
||||
begin
|
||||
Result := assigned(FOnLoadStart) or
|
||||
|
@ -385,6 +385,9 @@ type
|
||||
function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean;
|
||||
procedure doDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage);
|
||||
procedure doOnCookiesStoreFlushed;
|
||||
procedure doCertificateExceptionsCleared;
|
||||
procedure doHttpAuthCredentialsCleared;
|
||||
procedure doAllConnectionsClosed;
|
||||
function MustCreateLoadHandler : boolean;
|
||||
function MustCreateFocusHandler : boolean;
|
||||
function MustCreateContextMenuHandler : boolean;
|
||||
|
@ -54,7 +54,7 @@ uses
|
||||
{$ELSE}
|
||||
Classes, SysUtils,
|
||||
{$ENDIF}
|
||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFCompletionCallback;
|
||||
|
||||
type
|
||||
TCefRequestContextRef = class(TCefBaseRefCountedRef, ICefRequestContext)
|
||||
@ -92,11 +92,26 @@ type
|
||||
class function Shared(const other: ICefRequestContext; const handler: ICefRequestContextHandler): ICefRequestContext;
|
||||
end;
|
||||
|
||||
TCefClearCertificateExceptionsCompletionCallback = class(TCefCustomCompletionCallback)
|
||||
protected
|
||||
procedure OnComplete; override;
|
||||
end;
|
||||
|
||||
TCefClearHttpAuthCredentialsCompletionCallback = class(TCefCustomCompletionCallback)
|
||||
protected
|
||||
procedure OnComplete; override;
|
||||
end;
|
||||
|
||||
TCefCloseAllConnectionsCompletionCallback = class(TCefCustomCompletionCallback)
|
||||
protected
|
||||
procedure OnComplete; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue, uCEFCookieManager,
|
||||
uCEFCompletionCallback, uCEFRequestContextHandler, uCEFExtension, uCEFStringList;
|
||||
uCEFRequestContextHandler, uCEFExtension, uCEFStringList;
|
||||
|
||||
function TCefRequestContextRef.ClearSchemeHandlerFactories: Boolean;
|
||||
begin
|
||||
@ -314,4 +329,55 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
|
||||
// TCefClearCertificateExceptionsCompletionCallback
|
||||
|
||||
procedure TCefClearCertificateExceptionsCompletionCallback.OnComplete;
|
||||
begin
|
||||
try
|
||||
try
|
||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doCertificateExceptionsCleared;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCefClearCertificateExceptionsCompletionCallback.OnComplete', e) then raise;
|
||||
end;
|
||||
finally
|
||||
FEvents := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
// TCefClearHttpAuthCredentialsCompletionCallback
|
||||
|
||||
procedure TCefClearHttpAuthCredentialsCompletionCallback.OnComplete;
|
||||
begin
|
||||
try
|
||||
try
|
||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doHttpAuthCredentialsCleared;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCefClearHttpAuthCredentialsCompletionCallback.OnComplete', e) then raise;
|
||||
end;
|
||||
finally
|
||||
FEvents := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
// TCefCloseAllConnectionsCompletionCallback
|
||||
|
||||
procedure TCefCloseAllConnectionsCompletionCallback.OnComplete;
|
||||
begin
|
||||
try
|
||||
try
|
||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doAllConnectionsClosed;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCefCloseAllConnectionsCompletionCallback.OnComplete', e) then raise;
|
||||
end;
|
||||
finally
|
||||
FEvents := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"UpdateLazPackages" : [
|
||||
{
|
||||
"ForceNotify" : true,
|
||||
"InternalVersion" : 39,
|
||||
"ForceNotify" : false,
|
||||
"InternalVersion" : 40,
|
||||
"Name" : "cef4delphi_lazarus.lpk",
|
||||
"Version" : "77.1.11.0"
|
||||
"Version" : "77.1.12.0"
|
||||
}
|
||||
],
|
||||
"UpdatePackageData" : {
|
||||
|
Loading…
Reference in New Issue
Block a user