1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-01-03 10:15:38 +02:00

Update to CEF 3.3239.1720.g1ad5e2a

TChromium.DeleteCookies now uses the right cookie manager in custom request contexts.
This commit is contained in:
Salvador Díaz Fau 2018-01-05 11:59:25 +01:00
parent 9888fe3e46
commit 2f89f8a609
6 changed files with 36 additions and 43 deletions

View File

@ -57,7 +57,7 @@ uses
const
CEF_SUPPORTED_VERSION_MAJOR = 3;
CEF_SUPPORTED_VERSION_MINOR = 3239;
CEF_SUPPORTED_VERSION_RELEASE = 1716;
CEF_SUPPORTED_VERSION_RELEASE = 1720;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 63;

View File

@ -459,7 +459,7 @@ type
procedure StartDownload(const aURL : ustring);
procedure SimulateMouseWheel(aDeltaX, aDeltaY : integer);
procedure DeleteCookies;
function DeleteCookies : boolean;
procedure RetrieveHTML(const aFrameName : ustring = ''); overload;
procedure RetrieveHTML(const aFrame : ICefFrame); overload;
procedure RetrieveHTML(const aFrameIdentifier : int64); overload;
@ -1991,15 +1991,22 @@ begin
end;
end;
procedure TChromium.DeleteCookies;
function TChromium.DeleteCookies : boolean;
var
TempTask: ICefTask;
TempManager : ICefCookieManager;
begin
if Initialized then
Result := False;
if Initialized and (FBrowser.Host <> nil) and (FBrowser.Host.RequestContext <> nil) then
begin
if (FCookiDeletercb = nil) then FCookiDeletercb := TCefCustomDeleteCookiesCallback.Create(self);
TempTask := TCefDeleteCookiesTask.Create(FCookiDeletercb);
CefPostTask(TID_IO, TempTask);
TempManager := FBrowser.Host.RequestContext.GetDefaultCookieManager(nil);
if (TempManager <> nil) then
begin
if (FCookiDeletercb = nil) then FCookiDeletercb := TCefCustomDeleteCookiesCallback.Create(self);
Result := TempManager.DeleteCookies('', '', FCookiDeletercb);
end;
end;
end;

View File

@ -1393,11 +1393,18 @@ type
ICefUrlRequest = interface(ICefBaseRefCounted)
['{59226AC1-A0FA-4D59-9DF4-A65C42391A67}']
function GetRequest: ICefRequest;
function GetRequestStatus: TCefUrlRequestStatus;
function GetRequestError: Integer;
function GetResponse: ICefResponse;
function GetRequest: ICefRequest;
function GetRequestStatus: TCefUrlRequestStatus;
function GetRequestError: Integer;
function GetResponse: ICefResponse;
function GetResponseWasCached: boolean;
procedure Cancel;
property Request : ICefRequest read GetRequest;
property RequestStatus : TCefUrlRequestStatus read GetRequestStatus;
property RequestError : Integer read GetRequestError;
property Response : ICefResponse read GetResponse;
property ResponseWasCached : boolean read GetResponseWasCached;
end;
ICefUrlrequestClient = interface(ICefBaseRefCounted)

View File

@ -101,16 +101,6 @@ type
procedure Execute; override;
end;
TCefDeleteCookiesTask = class(TCefTaskOwn)
protected
FCallBack : ICefDeleteCookiesCallback;
procedure Execute; override;
public
constructor Create(const aCallBack : ICefDeleteCookiesCallback); reintroduce;
end;
TCefUpdatePrefsTask = class(TCefTaskOwn)
protected
FChromiumBrowser : TObject;
@ -268,25 +258,6 @@ begin
end;
// TCefDeleteCookiesTask
constructor TCefDeleteCookiesTask.Create(const aCallBack : ICefDeleteCookiesCallback);
begin
inherited Create;
FCallBack := aCallBack;
end;
procedure TCefDeleteCookiesTask.Execute;
var
CookieManager : ICefCookieManager;
begin
CookieManager := TCefCookieManagerRef.Global(nil);
CookieManager.DeleteCookies('', '', FCallBack);
end;
// TCefUpdatePrefsTask

View File

@ -1426,6 +1426,7 @@ type
get_request_status: function(self: PCefUrlRequest): TCefUrlRequestStatus; stdcall;
get_request_error: function(self: PCefUrlRequest): TCefErrorcode; stdcall;
get_response: function(self: PCefUrlRequest): PCefResponse; stdcall;
response_was_cached: function(self: PCefUrlRequest): integer; stdcall;
cancel: procedure(self: PCefUrlRequest); stdcall;
end;

View File

@ -56,6 +56,7 @@ type
function GetRequestStatus: TCefUrlRequestStatus;
function GetRequestError: Integer;
function GetResponse: ICefResponse;
function GetResponseWasCached: boolean;
procedure Cancel;
public
class function UnWrap(data: Pointer): ICefUrlRequest;
@ -94,6 +95,11 @@ begin
Result := PCefUrlRequest(FData).get_request_status(PCefUrlRequest(FData));
end;
function TCefUrlRequestRef.GetResponseWasCached: boolean;
begin
Result := PCefUrlRequest(FData).response_was_cached(PCefUrlRequest(FData)) <> 0;
end;
function TCefUrlRequestRef.GetResponse: ICefResponse;
begin
Result := TCefResponseRef.UnWrap(PCefUrlRequest(FData).get_response(PCefUrlRequest(FData)));
@ -101,8 +107,9 @@ end;
class function TCefUrlRequestRef.UnWrap(data: Pointer): ICefUrlRequest;
begin
if data <> nil then
Result := Create(data) as ICefUrlRequest else
if (data <> nil) then
Result := Create(data) as ICefUrlRequest
else
Result := nil;
end;