You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-22 22:17:48 +02:00
Fixed GlobalCEFApp.DeleteCache and GlobalCEFApp.DeleteCookies
Added mote Chrome URLs to uCEFConstants
This commit is contained in:
@ -269,6 +269,7 @@ type
|
|||||||
function GetApiHashCommit : ustring;
|
function GetApiHashCommit : ustring;
|
||||||
function GetExitCode : TCefResultCode;
|
function GetExitCode : TCefResultCode;
|
||||||
function GetBrowserById(aID : integer) : ICefBrowser;
|
function GetBrowserById(aID : integer) : ICefBrowser;
|
||||||
|
function GetCookiesDir(const aRootDirectory : string) : string;
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
function GetXDisplay : PXDisplay;
|
function GetXDisplay : PXDisplay;
|
||||||
function GetArgc : longint;
|
function GetArgc : longint;
|
||||||
@ -376,7 +377,7 @@ type
|
|||||||
function InitializeLibrary(const aApp : ICefApp) : boolean;
|
function InitializeLibrary(const aApp : ICefApp) : boolean;
|
||||||
procedure RenameAndDeleteDir(const aDirectory : string; aKeepCookies : boolean = False);
|
procedure RenameAndDeleteDir(const aDirectory : string; aKeepCookies : boolean = False);
|
||||||
procedure DeleteCacheContents(const aDirectory : string);
|
procedure DeleteCacheContents(const aDirectory : string);
|
||||||
procedure DeleteCookiesDB(const aDirectory : string);
|
procedure DeleteCookiesDB(const aRootDirectory : string);
|
||||||
procedure MoveCookiesDB(const aSrcDirectory, aDstDirectory : string);
|
procedure MoveCookiesDB(const aSrcDirectory, aDstDirectory : string);
|
||||||
function MultiExeProcessing : boolean;
|
function MultiExeProcessing : boolean;
|
||||||
function SingleExeProcessing : boolean;
|
function SingleExeProcessing : boolean;
|
||||||
@ -2919,6 +2920,7 @@ end;
|
|||||||
function TCefApplicationCore.InitializeLibrary(const aApp : ICefApp) : boolean;
|
function TCefApplicationCore.InitializeLibrary(const aApp : ICefApp) : boolean;
|
||||||
var
|
var
|
||||||
TempArgs : TCefMainArgs;
|
TempArgs : TCefMainArgs;
|
||||||
|
TempRootDir : string;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
@ -2926,14 +2928,19 @@ begin
|
|||||||
try
|
try
|
||||||
if (aApp <> nil) then
|
if (aApp <> nil) then
|
||||||
begin
|
begin
|
||||||
|
if (length(FRootCache) > 0) then
|
||||||
|
TempRootDir := FRootCache
|
||||||
|
else
|
||||||
|
TempRootDir := FCache;
|
||||||
|
|
||||||
if FDeleteCache and FDeleteCookies then
|
if FDeleteCache and FDeleteCookies then
|
||||||
RenameAndDeleteDir(FCache)
|
RenameAndDeleteDir(TempRootDir)
|
||||||
else
|
else
|
||||||
if FDeleteCookies then
|
if FDeleteCookies then
|
||||||
DeleteCookiesDB(IncludeTrailingPathDelimiter(FCache) + 'Network')
|
DeleteCookiesDB(TempRootDir)
|
||||||
else
|
else
|
||||||
if FDeleteCache then
|
if FDeleteCache then
|
||||||
RenameAndDeleteDir(FCache, True);
|
RenameAndDeleteDir(TempRootDir, True);
|
||||||
|
|
||||||
InitializeSettings(FAppSettings);
|
InitializeSettings(FAppSettings);
|
||||||
InitializeCefMainArgs(TempArgs);
|
InitializeCefMainArgs(TempArgs);
|
||||||
@ -2970,15 +2977,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplicationCore.DeleteCookiesDB(const aDirectory : string);
|
function TCefApplicationCore.GetCookiesDir(const aRootDirectory : string) : string;
|
||||||
|
begin
|
||||||
|
Result := IncludeTrailingPathDelimiter(aRootDirectory) + 'Default';
|
||||||
|
Result := IncludeTrailingPathDelimiter(Result) + 'Network';
|
||||||
|
Result := IncludeTrailingPathDelimiter(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefApplicationCore.DeleteCookiesDB(const aRootDirectory : string);
|
||||||
var
|
var
|
||||||
TempFiles : TStringList;
|
TempFiles : TStringList;
|
||||||
|
TempCookiesDir : string;
|
||||||
begin
|
begin
|
||||||
TempFiles := TStringList.Create;
|
TempFiles := TStringList.Create;
|
||||||
|
|
||||||
try
|
try
|
||||||
TempFiles.Add(IncludeTrailingPathDelimiter(aDirectory) + 'Cookies');
|
TempCookiesDir := GetCookiesDir(aRootDirectory);
|
||||||
TempFiles.Add(IncludeTrailingPathDelimiter(aDirectory) + 'Cookies-journal');
|
|
||||||
|
TempFiles.Add(TempCookiesDir + 'Cookies');
|
||||||
|
TempFiles.Add(TempCookiesDir + 'Cookies-journal');
|
||||||
|
|
||||||
DeleteFileList(TempFiles);
|
DeleteFileList(TempFiles);
|
||||||
finally
|
finally
|
||||||
@ -2994,12 +3011,12 @@ begin
|
|||||||
TempFiles := TStringList.Create;
|
TempFiles := TStringList.Create;
|
||||||
|
|
||||||
try
|
try
|
||||||
TempFiles.Add('LocalPrefs.json');
|
TempFiles.Add('Local State');
|
||||||
|
|
||||||
MoveFileList(TempFiles, aSrcDirectory, aDstDirectory);
|
MoveFileList(TempFiles, aSrcDirectory, aDstDirectory);
|
||||||
|
|
||||||
TempSrc := IncludeTrailingPathDelimiter(aSrcDirectory) + 'Network';
|
TempSrc := GetCookiesDir(aSrcDirectory);
|
||||||
TempDst := IncludeTrailingPathDelimiter(aDstDirectory) + 'Network';
|
TempDst := GetCookiesDir(aDstDirectory);
|
||||||
|
|
||||||
TempFiles.Clear;
|
TempFiles.Clear;
|
||||||
TempFiles.Add('Cookies');
|
TempFiles.Add('Cookies');
|
||||||
@ -3034,7 +3051,8 @@ begin
|
|||||||
|
|
||||||
if RenameFile(TempOldDir, TempNewDir) then
|
if RenameFile(TempOldDir, TempNewDir) then
|
||||||
begin
|
begin
|
||||||
if aKeepCookies then MoveCookiesDB(TempNewDir, TempOldDir);
|
if aKeepCookies then
|
||||||
|
MoveCookiesDB(TempNewDir, TempOldDir);
|
||||||
|
|
||||||
TempThread := TCEFDirectoryDeleterThread.Create(TempNewDir);
|
TempThread := TCEFDirectoryDeleterThread.Create(TempNewDir);
|
||||||
{$IFDEF DELPHI14_UP}
|
{$IFDEF DELPHI14_UP}
|
||||||
|
@ -4885,6 +4885,11 @@ const
|
|||||||
CEF_SETTINGS_URL = 'chrome://settings';
|
CEF_SETTINGS_URL = 'chrome://settings';
|
||||||
CEF_DOWNLOADS_URL = 'chrome://downloads';
|
CEF_DOWNLOADS_URL = 'chrome://downloads';
|
||||||
CEF_EXTENSIONS_URL = 'chrome://extensions';
|
CEF_EXTENSIONS_URL = 'chrome://extensions';
|
||||||
|
CEF_INSPECT_URL = 'chrome://inspect';
|
||||||
|
CEF_GPU_URL = 'chrome://gpu';
|
||||||
|
CEF_PREFS_URL = 'chrome://prefs-internals';
|
||||||
|
CEF_CERTMANAGER_URL = 'chrome://certificate-manager';
|
||||||
|
CEF_MEMORY_URL = 'chrome://memory-internals';
|
||||||
|
|
||||||
// These contants are declared in the "Windows" unit but
|
// These contants are declared in the "Windows" unit but
|
||||||
// some old Delphi versions don't have them.
|
// some old Delphi versions don't have them.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 686,
|
"InternalVersion" : 687,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "131.3.4"
|
"Version" : "131.3.4"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user