mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-02 21:57:37 +02:00
Added TChromiumCore.ClearDataForOrigin procedure
Added a menu option to the MiniBrowser demo to clear all data from the current URL
This commit is contained in:
parent
d394d41991
commit
59ec2022e5
@ -380,6 +380,10 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
Caption = 'Clear cache'
|
Caption = 'Clear cache'
|
||||||
OnClick = Clearcache1Click
|
OnClick = Clearcache1Click
|
||||||
end
|
end
|
||||||
|
object ClearallstorageforcurrentURL1: TMenuItem
|
||||||
|
Caption = 'Clear all storage for current URL'
|
||||||
|
OnClick = ClearallstorageforcurrentURL1Click
|
||||||
|
end
|
||||||
object akescreenshot1: TMenuItem
|
object akescreenshot1: TMenuItem
|
||||||
Caption = 'Take screenshot'
|
Caption = 'Take screenshot'
|
||||||
OnClick = akescreenshot1Click
|
OnClick = akescreenshot1Click
|
||||||
|
@ -137,6 +137,7 @@ type
|
|||||||
Clearcache1: TMenuItem;
|
Clearcache1: TMenuItem;
|
||||||
akescreenshot1: TMenuItem;
|
akescreenshot1: TMenuItem;
|
||||||
Useragent1: TMenuItem;
|
Useragent1: TMenuItem;
|
||||||
|
ClearallstorageforcurrentURL1: TMenuItem;
|
||||||
|
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
@ -204,6 +205,7 @@ type
|
|||||||
procedure Clearcache1Click(Sender: TObject);
|
procedure Clearcache1Click(Sender: TObject);
|
||||||
procedure akescreenshot1Click(Sender: TObject);
|
procedure akescreenshot1Click(Sender: TObject);
|
||||||
procedure Useragent1Click(Sender: TObject);
|
procedure Useragent1Click(Sender: TObject);
|
||||||
|
procedure ClearallstorageforcurrentURL1Click(Sender: TObject);
|
||||||
|
|
||||||
protected
|
protected
|
||||||
FScreenshotMsgID : integer;
|
FScreenshotMsgID : integer;
|
||||||
@ -984,6 +986,11 @@ begin
|
|||||||
ShowStatusText('Zoom : ' + floattostr(aZoomPct) + '%');
|
ShowStatusText('Zoom : ' + floattostr(aZoomPct) + '%');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.ClearallstorageforcurrentURL1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.ClearDataForOrigin(URLCbx.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Clearcache1Click(Sender: TObject);
|
procedure TMiniBrowserFrm.Clearcache1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.ClearCache;
|
Chromium1.ClearCache;
|
||||||
|
@ -695,7 +695,8 @@ type
|
|||||||
procedure ResolveHost(const aURL : ustring);
|
procedure ResolveHost(const aURL : ustring);
|
||||||
function IsSameBrowser(const aBrowser : ICefBrowser) : boolean;
|
function IsSameBrowser(const aBrowser : ICefBrowser) : boolean;
|
||||||
function ExecuteTaskOnCefThread(aCefThreadId : TCefThreadId; aTaskID : cardinal; aDelayMs : Int64 = 0) : boolean;
|
function ExecuteTaskOnCefThread(aCefThreadId : TCefThreadId; aTaskID : cardinal; aDelayMs : Int64 = 0) : boolean;
|
||||||
procedure SetUserAgentOverride(const aUserAgent : string; const aAcceptLanguage : string = ''; const aPlatform : string = '');
|
procedure SetUserAgentOverride(const aUserAgent : ustring; const aAcceptLanguage : ustring = ''; const aPlatform : ustring = '');
|
||||||
|
procedure ClearDataForOrigin(const aOriginURL : ustring; aStorageTypes : TCefClearDataStorageTypes = cdstAll);
|
||||||
procedure ClearCache;
|
procedure ClearCache;
|
||||||
|
|
||||||
function DeleteCookies(const url : ustring = ''; const cookieName : ustring = ''; aDeleteImmediately : boolean = False) : boolean;
|
function DeleteCookies(const url : ustring = ''; const cookieName : ustring = ''; aDeleteImmediately : boolean = False) : boolean;
|
||||||
@ -2963,7 +2964,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.SetUserAgentOverride(const aUserAgent, aAcceptLanguage, aPlatform : string);
|
procedure TChromiumCore.SetUserAgentOverride(const aUserAgent, aAcceptLanguage, aPlatform : ustring);
|
||||||
var
|
var
|
||||||
TempParams : ICefDictionaryValue;
|
TempParams : ICefDictionaryValue;
|
||||||
begin
|
begin
|
||||||
@ -2983,6 +2984,33 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumCore.ClearDataForOrigin(const aOriginURL : ustring; aStorageTypes : TCefClearDataStorageTypes);
|
||||||
|
var
|
||||||
|
TempParams : ICefDictionaryValue;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
TempParams := TCefDictionaryValueRef.New;
|
||||||
|
TempParams.SetString('origin', aOriginURL);
|
||||||
|
|
||||||
|
case aStorageTypes of
|
||||||
|
cdstAppCache : TempParams.SetString('storageTypes', 'appcache');
|
||||||
|
cdstCookies : TempParams.SetString('storageTypes', 'cookies');
|
||||||
|
cdstFileSystems : TempParams.SetString('storageTypes', 'file_systems');
|
||||||
|
cdstIndexeddb : TempParams.SetString('storageTypes', 'indexeddb');
|
||||||
|
cdstLocalStorage : TempParams.SetString('storageTypes', 'local_storage');
|
||||||
|
cdstShaderCache : TempParams.SetString('storageTypes', 'shader_cache');
|
||||||
|
cdstWebsql : TempParams.SetString('storageTypes', 'websql');
|
||||||
|
cdstServiceWorkers : TempParams.SetString('storageTypes', 'service_workers');
|
||||||
|
cdstCacheStorage : TempParams.SetString('storageTypes', 'cache_storage');
|
||||||
|
else TempParams.SetString('storageTypes', 'all');
|
||||||
|
end;
|
||||||
|
|
||||||
|
ExecuteDevToolsMethod(0, 'Storage.clearDataForOrigin', TempParams);
|
||||||
|
finally
|
||||||
|
TempParams := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.SetYouTubeRestrict(aValue : integer);
|
procedure TChromiumCore.SetYouTubeRestrict(aValue : integer);
|
||||||
begin
|
begin
|
||||||
if (FYouTubeRestrict <> aValue) then
|
if (FYouTubeRestrict <> aValue) then
|
||||||
|
@ -431,6 +431,17 @@ type
|
|||||||
|
|
||||||
TCefProxyScheme = (psHTTP, psSOCKS4, psSOCKS5);
|
TCefProxyScheme = (psHTTP, psSOCKS4, psSOCKS5);
|
||||||
|
|
||||||
|
TCefClearDataStorageTypes = (cdstAppCache,
|
||||||
|
cdstCookies,
|
||||||
|
cdstFileSystems,
|
||||||
|
cdstIndexeddb,
|
||||||
|
cdstLocalStorage,
|
||||||
|
cdstShaderCache,
|
||||||
|
cdstWebsql,
|
||||||
|
cdstServiceWorkers,
|
||||||
|
cdstCacheStorage,
|
||||||
|
cdstAll);
|
||||||
|
|
||||||
TCefAutoplayPolicy = (appDefault,
|
TCefAutoplayPolicy = (appDefault,
|
||||||
appDocumentUserActivationRequired,
|
appDocumentUserActivationRequired,
|
||||||
appNoUserGestureRequired,
|
appNoUserGestureRequired,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 156,
|
"InternalVersion" : 157,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "83.4.2.0"
|
"Version" : "83.4.2.0"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user