mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-01-13 10:22:04 +02:00
Update to CEF 3.3578.1863.gbf8cff2
- Removed obsolete "Result" parameter in all OSR demos. - Added more code comments to ResponseFilterBrowser. - Now ResponseFilterBrowser modifies the HTTP request to receive uncompressed resources. - Updated compiler properties in Delphinus.Install.json
This commit is contained in:
parent
fe702f2a2f
commit
a8c44bd87b
@ -31,11 +31,62 @@
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 22,
|
||||
"compiler_max": 31,
|
||||
"compiler_max": 22,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 23,
|
||||
"compiler_max": 23,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 24,
|
||||
"compiler_max": 24,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 25,
|
||||
"compiler_max": 25,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 26,
|
||||
"compiler_max": 26,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 27,
|
||||
"compiler_max": 27,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 28,
|
||||
"compiler_max": 28,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 29,
|
||||
"compiler_max": 29,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 30,
|
||||
"compiler_max": 30,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi.dproj",
|
||||
"compiler_min": 31,
|
||||
"compiler_max": 31,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi_FMX.dproj",
|
||||
"compiler_min": 32
|
||||
"compiler_min": 32,
|
||||
"compiler_max": 32,
|
||||
}
|
||||
{
|
||||
"project": "packages\\CEF4Delphi_FMX.dproj",
|
||||
"compiler_min": 33,
|
||||
"compiler_max": 33,
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -39,9 +39,6 @@ object WebBrowserFrm: TWebBrowserFrm
|
||||
OnMouseUp = Panel1MouseUp
|
||||
OnResize = Panel1Resize
|
||||
OnMouseLeave = Panel1MouseLeave
|
||||
ExplicitTop = 30
|
||||
ExplicitWidth = 988
|
||||
ExplicitHeight = 638
|
||||
end
|
||||
object chrmosr: TChromium
|
||||
OnTooltip = chrmosrTooltip
|
||||
|
@ -81,7 +81,7 @@ type
|
||||
|
||||
procedure chrmosrPaint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer);
|
||||
procedure chrmosrCursorChange(Sender: TObject; const browser: ICefBrowser; cursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo);
|
||||
procedure chrmosrGetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect; out Result: Boolean);
|
||||
procedure chrmosrGetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect);
|
||||
procedure chrmosrGetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean);
|
||||
procedure chrmosrGetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
|
||||
procedure chrmosrPopupShow(Sender: TObject; const browser: ICefBrowser; show: Boolean);
|
||||
@ -283,42 +283,44 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrBeforePopup(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
const targetUrl : ustring;
|
||||
const targetFrameName : ustring;
|
||||
targetDisposition : TCefWindowOpenDisposition;
|
||||
userGesture : Boolean;
|
||||
const popupFeatures : TCefPopupFeatures;
|
||||
var windowInfo : TCefWindowInfo;
|
||||
var client : ICefClient;
|
||||
var settings : TCefBrowserSettings;
|
||||
var noJavascriptAccess : Boolean;
|
||||
var Result : Boolean);
|
||||
procedure TWebBrowserFrm.chrmosrBeforePopup( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
const targetUrl : ustring;
|
||||
const targetFrameName : ustring;
|
||||
targetDisposition : TCefWindowOpenDisposition;
|
||||
userGesture : Boolean;
|
||||
const popupFeatures : TCefPopupFeatures;
|
||||
var windowInfo : TCefWindowInfo;
|
||||
var client : ICefClient;
|
||||
var settings : TCefBrowserSettings;
|
||||
var noJavascriptAccess : Boolean;
|
||||
var Result : Boolean);
|
||||
begin
|
||||
// For simplicity, this demo blocks all popup windows and new tabs
|
||||
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||
procedure TWebBrowserFrm.chrmosrClose( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
out Result : Boolean);
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrCursorChange(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
cursor : HICON;
|
||||
cursorType : TCefCursorType;
|
||||
const customCursorInfo : PCefCursorInfo);
|
||||
procedure TWebBrowserFrm.chrmosrCursorChange( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
cursor : HICON;
|
||||
cursorType : TCefCursorType;
|
||||
const customCursorInfo : PCefCursorInfo);
|
||||
begin
|
||||
Panel1.Cursor := GefCursorToWindowsCursor(cursorType);
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrGetScreenInfo(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var screenInfo : TCefScreenInfo;
|
||||
out Result : Boolean);
|
||||
procedure TWebBrowserFrm.chrmosrGetScreenInfo( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var screenInfo : TCefScreenInfo;
|
||||
out Result : Boolean);
|
||||
var
|
||||
TempRect : TCEFRect;
|
||||
begin
|
||||
@ -342,13 +344,13 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrGetScreenPoint(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
viewX : Integer;
|
||||
viewY : Integer;
|
||||
var screenX : Integer;
|
||||
var screenY : Integer;
|
||||
out Result : Boolean);
|
||||
procedure TWebBrowserFrm.chrmosrGetScreenPoint( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
viewX : Integer;
|
||||
viewY : Integer;
|
||||
var screenX : Integer;
|
||||
var screenY : Integer;
|
||||
out Result : Boolean);
|
||||
var
|
||||
TempScreenPt, TempViewPt : TPoint;
|
||||
begin
|
||||
@ -365,10 +367,9 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrGetViewRect(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var rect : TCefRect;
|
||||
out Result : Boolean);
|
||||
procedure TWebBrowserFrm.chrmosrGetViewRect( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var rect : TCefRect);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
@ -376,20 +377,17 @@ begin
|
||||
rect.y := 0;
|
||||
rect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor);
|
||||
rect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor);
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrPaint(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
kind : TCefPaintElementType;
|
||||
dirtyRectsCount : NativeUInt;
|
||||
const dirtyRects : PCefRectArray;
|
||||
const buffer : Pointer;
|
||||
width : Integer;
|
||||
height : Integer);
|
||||
procedure TWebBrowserFrm.chrmosrPaint( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
kind : TCefPaintElementType;
|
||||
dirtyRectsCount : NativeUInt;
|
||||
const dirtyRects : PCefRectArray;
|
||||
const buffer : Pointer;
|
||||
width : Integer;
|
||||
height : Integer);
|
||||
var
|
||||
src, dst: PByte;
|
||||
i, j, TempLineSize, TempSrcOffset, TempDstOffset, SrcStride, DstStride : Integer;
|
||||
@ -492,9 +490,9 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrPopupShow(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
show : Boolean);
|
||||
procedure TWebBrowserFrm.chrmosrPopupShow( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
show : Boolean);
|
||||
begin
|
||||
if show then
|
||||
FShowPopUp := True
|
||||
@ -507,9 +505,9 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrPopupSize(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const rect : PCefRect);
|
||||
procedure TWebBrowserFrm.chrmosrPopupSize( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const rect : PCefRect);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
@ -522,7 +520,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWebBrowserFrm.chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean);
|
||||
procedure TWebBrowserFrm.chrmosrTooltip( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var text : ustring;
|
||||
out Result : Boolean);
|
||||
begin
|
||||
Panel1.hint := text;
|
||||
Panel1.ShowHint := (length(text) > 0);
|
||||
|
@ -27,9 +27,9 @@ object ChildForm: TChildForm
|
||||
Width = 352
|
||||
Height = 256
|
||||
Align = alClient
|
||||
ParentBackground = False
|
||||
Caption = 'Panel1'
|
||||
Color = clWhite
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
TabStop = True
|
||||
OnClick = Panel1Click
|
||||
@ -44,7 +44,6 @@ object ChildForm: TChildForm
|
||||
object Chromium1: TChromium
|
||||
OnTitleChange = Chromium1TitleChange
|
||||
OnTooltip = Chromium1Tooltip
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnGetViewRect = Chromium1GetViewRect
|
||||
|
@ -79,7 +79,7 @@ type
|
||||
|
||||
procedure Chromium1Paint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer);
|
||||
procedure Chromium1CursorChange(Sender: TObject; const browser: ICefBrowser; cursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo);
|
||||
procedure Chromium1GetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect; out Result: Boolean);
|
||||
procedure Chromium1GetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect);
|
||||
procedure Chromium1GetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean);
|
||||
procedure Chromium1GetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
|
||||
procedure Chromium1PopupShow(Sender: TObject; const browser: ICefBrowser; show: Boolean);
|
||||
@ -421,8 +421,7 @@ end;
|
||||
|
||||
procedure TChildForm.Chromium1GetViewRect(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var rect : TCefRect;
|
||||
out Result : Boolean);
|
||||
var rect : TCefRect);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
@ -430,10 +429,7 @@ begin
|
||||
rect.y := 0;
|
||||
rect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor);
|
||||
rect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor);
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1Paint(Sender : TObject;
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uChildForm,
|
||||
Vcl.AppEvnts;
|
||||
Vcl.AppEvnts, uCEFWinControl;
|
||||
|
||||
const
|
||||
CEF_CREATENEXTCHILD = WM_APP + $A50;
|
||||
|
@ -47,7 +47,7 @@ uses
|
||||
Forms,
|
||||
Windows,
|
||||
{$ENDIF }
|
||||
uCEFApplication,
|
||||
uCEFApplication, uCEFConstants,
|
||||
uResponseFilterBrowser in 'uResponseFilterBrowser.pas' {ResponseFilterBrowserFrm};
|
||||
|
||||
{$R *.res}
|
||||
@ -58,6 +58,9 @@ uses
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
|
||||
GlobalCEFApp.LogFile := 'cef.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
Application.Initialize;
|
||||
|
@ -51,7 +51,7 @@ object ResponseFilterBrowserFrm: TResponseFilterBrowserFrm
|
||||
Align = alClient
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
Text = 'https://www.briskbard.com'
|
||||
Text = 'https://www.briskbard.com/'
|
||||
ExplicitHeight = 21
|
||||
end
|
||||
object Panel1: TPanel
|
||||
@ -74,6 +74,7 @@ object ResponseFilterBrowserFrm: TResponseFilterBrowserFrm
|
||||
Caption = 'Go'
|
||||
TabOrder = 0
|
||||
OnClick = GoBtnClick
|
||||
ExplicitTop = -1
|
||||
end
|
||||
object RscNameEdt: TEdit
|
||||
Left = 176
|
||||
@ -89,7 +90,9 @@ object ResponseFilterBrowserFrm: TResponseFilterBrowserFrm
|
||||
Width = 96
|
||||
Height = 17
|
||||
Caption = 'Copy script :'
|
||||
Checked = True
|
||||
TabOrder = 2
|
||||
TabStop = True
|
||||
end
|
||||
object ReplaceLogoBtn: TRadioButton
|
||||
Left = 74
|
||||
@ -97,9 +100,7 @@ object ResponseFilterBrowserFrm: TResponseFilterBrowserFrm
|
||||
Width = 96
|
||||
Height = 17
|
||||
Caption = 'Replace logo'
|
||||
Checked = True
|
||||
TabOrder = 3
|
||||
TabStop = True
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -163,6 +164,8 @@ object ResponseFilterBrowserFrm: TResponseFilterBrowserFrm
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnBeforeResourceLoad = Chromium1BeforeResourceLoad
|
||||
OnResourceResponse = Chromium1ResourceResponse
|
||||
OnGetResourceResponseFilter = Chromium1GetResourceResponseFilter
|
||||
OnResourceLoadComplete = Chromium1ResourceLoadComplete
|
||||
Left = 56
|
||||
|
@ -50,7 +50,8 @@ uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs, ComCtrls, pngimage,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uCEFResponseFilter;
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uCEFResponseFilter,
|
||||
uCEFWinControl;
|
||||
|
||||
const
|
||||
STREAM_COPY_COMPLETE = WM_APP + $B00;
|
||||
@ -79,6 +80,8 @@ type
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1LoadStart(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; transitionType: Cardinal);
|
||||
procedure Chromium1BeforeResourceLoad(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const callback: ICefRequestCallback; out Result: TCefReturnValue);
|
||||
procedure Chromium1ResourceResponse(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const response: ICefResponse; out Result: Boolean);
|
||||
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
@ -87,6 +90,7 @@ type
|
||||
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
|
||||
protected
|
||||
FFilter : ICefResponseFilter; // CEF Filter interface that receives the resource contents
|
||||
FStream : TMemoryStream; // TMemoryStream to hold the resource contents
|
||||
@ -116,6 +120,7 @@ type
|
||||
procedure ReplaceLogo(data_in: Pointer; data_in_size: NativeUInt; var data_in_read: NativeUInt; data_out: Pointer; data_out_size : NativeUInt; var data_out_written: NativeUInt; var aResult : TCefResponseFilterStatus);
|
||||
procedure UpdateRscEncoding(const aMimeType, aContentType : string);
|
||||
function IsMyResource(const aRequest : ICefRequest) : boolean;
|
||||
procedure CheckResponseHeaders(const response : ICefResponse);
|
||||
{$IFDEF DELPHI15_UP}
|
||||
procedure GetResponseEncoding(const aContentType: string);
|
||||
{$ENDIF}
|
||||
@ -136,7 +141,7 @@ uses
|
||||
{$ELSE}
|
||||
Math,
|
||||
{$ENDIF}
|
||||
uCEFApplication, uCEFMiscFunctions;
|
||||
uCEFApplication, uCEFMiscFunctions, uCEFStringMultimap;
|
||||
|
||||
// This demo uses a TCustomResponseFilter to read the contents from a
|
||||
// JavaScript file in briskbard.com into a TMemoryStream. The stream
|
||||
@ -174,6 +179,14 @@ uses
|
||||
// This will trigger the TCustomResponseFilter.OnFilter event again and you
|
||||
// will be able to send another chunk.
|
||||
|
||||
// If the server sends compressed data or it doesn't include a "Content-Length"
|
||||
// HTTP response header then the filter *might* fail. In this case,
|
||||
// Filter_OnFilter will receive a NIL value in data_in before the recource
|
||||
// response is really complete.
|
||||
|
||||
// If this demo is too complicated or the filter fails, consider using the
|
||||
// URLRequest demo if possible.
|
||||
|
||||
procedure TResponseFilterBrowserFrm.Filter_OnFilter( Sender : TObject;
|
||||
data_in : Pointer;
|
||||
data_in_size : NativeUInt;
|
||||
@ -385,70 +398,90 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.Chromium1BeforePopup(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
|
||||
var windowInfo: TCefWindowInfo; var client: ICefClient;
|
||||
var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean;
|
||||
var Result: Boolean);
|
||||
procedure TResponseFilterBrowserFrm.Chromium1BeforePopup( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
const targetUrl : ustring;
|
||||
const targetFrameName : ustring;
|
||||
targetDisposition : TCefWindowOpenDisposition;
|
||||
userGesture : Boolean;
|
||||
const popupFeatures : TCefPopupFeatures;
|
||||
var windowInfo : TCefWindowInfo;
|
||||
var client : ICefClient;
|
||||
var settings : TCefBrowserSettings;
|
||||
var noJavascriptAccess : Boolean;
|
||||
var Result : Boolean);
|
||||
begin
|
||||
// For simplicity, this demo blocks all popup windows and new tabs
|
||||
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.Chromium1BeforeResourceLoad( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
const request : ICefRequest;
|
||||
const callback : ICefRequestCallback;
|
||||
out Result : TCefReturnValue);
|
||||
var
|
||||
TempOldMap, TempNewMap : ICefStringMultimap;
|
||||
i : NativeUInt;
|
||||
TempReplaced : boolean;
|
||||
begin
|
||||
Result := RV_CONTINUE;
|
||||
|
||||
try
|
||||
// We replace the Accept-Encoding HTTP header to request uncompressed resources.
|
||||
// If the server sends uncompressed resources it should be easier to handle the
|
||||
// end of the resource reception because we may know its length.
|
||||
|
||||
TempNewMap := TCefStringMultimapOwn.Create;
|
||||
TempOldMap := TCefStringMultimapOwn.Create;
|
||||
|
||||
request.GetHeaderMap(TempOldMap);
|
||||
|
||||
TempReplaced := False;
|
||||
i := 0;
|
||||
while (i < TempOldMap.Size) do
|
||||
begin
|
||||
if (CompareText(TempOldMap.Key[i], 'Accept-Encoding') = 0) then
|
||||
begin
|
||||
TempNewMap.Append('Accept-Encoding', 'identity');
|
||||
TempReplaced := True;
|
||||
end
|
||||
else
|
||||
TempNewMap.Append(TempOldMap.Key[i], TempOldMap.Value[i]);
|
||||
|
||||
inc(i);
|
||||
end;
|
||||
|
||||
if not(TempReplaced) then TempNewMap.Append('Accept-Encoding', 'identity');
|
||||
request.SetHeaderMap(TempNewMap);
|
||||
finally
|
||||
TempNewMap := nil;
|
||||
TempOldMap := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.Chromium1GetResourceResponseFilter(Sender : TObject;
|
||||
procedure TResponseFilterBrowserFrm.Chromium1GetResourceResponseFilter( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
const request : ICefRequest;
|
||||
const response : ICefResponse;
|
||||
out Result : ICefResponseFilter);
|
||||
var
|
||||
TempContentLength, TempContentEncoding : string;
|
||||
TempLen : integer;
|
||||
begin
|
||||
if not(FRscCompleted) and (response <> nil) and IsMyResource(request) then
|
||||
begin
|
||||
try
|
||||
FStreamCS.Acquire;
|
||||
Result := FFilter;
|
||||
FFilterInit := True;
|
||||
|
||||
Result := FFilter;
|
||||
FFilterInit := True;
|
||||
TempContentEncoding := trim(lowercase(response.GetHeader('Content-Encoding')));
|
||||
|
||||
if (length(TempContentEncoding) > 0) and (TempContentEncoding <> 'identity') then
|
||||
begin
|
||||
// We can't use this information because Content-Length has the
|
||||
// compressed length but the OnFilter event has uncompressed data.
|
||||
FRscSize := -1;
|
||||
StatusBar1.Panels[0].Text := 'Content-Length : compressed';
|
||||
end
|
||||
else
|
||||
begin
|
||||
TempContentLength := trim(response.GetHeader('Content-Length'));
|
||||
|
||||
if TryStrToInt(TempContentLength, TempLen) and (TempLen > 0) then
|
||||
begin
|
||||
FRscSize := TempLen;
|
||||
StatusBar1.Panels[0].Text := 'Content-Length : ' + inttostr(FRscSize);
|
||||
end
|
||||
else
|
||||
begin
|
||||
FRscSize := -1;
|
||||
StatusBar1.Panels[0].Text := 'Content-Length : not available';
|
||||
end;
|
||||
end;
|
||||
|
||||
UpdateRscEncoding(response.MimeType, response.GetHeader('Content-Type'));
|
||||
finally
|
||||
FStreamCS.Release;
|
||||
end;
|
||||
CheckResponseHeaders(response);
|
||||
UpdateRscEncoding(response.MimeType, response.GetHeader('Content-Type'));
|
||||
end
|
||||
else
|
||||
Result := nil;
|
||||
@ -498,7 +531,43 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.Chromium1ResourceLoadComplete(Sender : TObject;
|
||||
procedure TResponseFilterBrowserFrm.CheckResponseHeaders(const response : ICefResponse);
|
||||
var
|
||||
TempContentLength, TempContentEncoding : string;
|
||||
TempLen : integer;
|
||||
begin
|
||||
try
|
||||
FStreamCS.Acquire;
|
||||
|
||||
TempContentEncoding := trim(lowercase(response.GetHeader('Content-Encoding')));
|
||||
|
||||
if (length(TempContentEncoding) > 0) and (TempContentEncoding <> 'identity') then
|
||||
begin
|
||||
// We can't use this information because Content-Length has the
|
||||
// compressed length but the OnFilter event has uncompressed data.
|
||||
FRscSize := -1;
|
||||
StatusBar1.Panels[0].Text := 'Content-Length : compressed';
|
||||
end
|
||||
else
|
||||
begin
|
||||
TempContentLength := trim(response.GetHeader('Content-Length'));
|
||||
|
||||
if (length(TempContentLength) > 0) and
|
||||
TryStrToInt(TempContentLength, TempLen) and
|
||||
(TempLen > 0) then
|
||||
begin
|
||||
FRscSize := TempLen;
|
||||
StatusBar1.Panels[0].Text := 'Content-Length : ' + inttostr(FRscSize);
|
||||
end
|
||||
else
|
||||
StatusBar1.Panels[0].Text := 'Content-Length : not available';
|
||||
end;
|
||||
finally
|
||||
FStreamCS.Release;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.Chromium1ResourceLoadComplete( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
const request : ICefRequest;
|
||||
@ -525,6 +594,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.Chromium1ResourceResponse( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
const request : ICefRequest;
|
||||
const response : ICefResponse;
|
||||
out Result : Boolean);
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not(FRscCompleted) and (response <> nil) and IsMyResource(request) then
|
||||
begin
|
||||
CheckResponseHeaders(response);
|
||||
UpdateRscEncoding(response.MimeType, response.GetHeader('Content-Type'));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
Caption := 'Response Filter Browser';
|
||||
|
@ -21,8 +21,9 @@
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<TopLine Value="19"/>
|
||||
<CursorPos X="63" Y="204"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="83"/>
|
||||
<CursorPos X="43" Y="92"/>
|
||||
<UsageCount Value="42"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="40" Y="252" ID="4"/>
|
||||
@ -43,11 +44,10 @@
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\source\uBufferPanel.pas"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="32"/>
|
||||
<CursorPos Y="284"/>
|
||||
<UsageCount Value="17"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\..\..\lcl\lcltype.pp"/>
|
||||
@ -61,11 +61,10 @@
|
||||
<Unit5>
|
||||
<Filename Value="C:\lazarus\lcl\forms.pp"/>
|
||||
<UnitName Value="Forms"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="243"/>
|
||||
<CursorPos X="43" Y="268"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="C:\lazarus\lcl\graphics.pp"/>
|
||||
@ -157,24 +156,21 @@
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="..\..\source\uCEFApplication.pas"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="28"/>
|
||||
<CursorPos X="59" Y="1103"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="..\..\source\uCEFChromium.pas"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="559"/>
|
||||
<CursorPos Y="570"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="97"/>
|
||||
<CursorPos Y="651"/>
|
||||
<UsageCount Value="10"/>
|
||||
@ -182,7 +178,6 @@
|
||||
<Item0 X="23" Y="177" ID="2"/>
|
||||
<Item1 X="58" Y="279" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="..\..\source\uCEFTypes.pas"/>
|
||||
@ -193,18 +188,16 @@
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm.pas"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="286"/>
|
||||
<CursorPos X="33" Y="323"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm_dyn.pas"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="23" Y="17"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\buildwinutilsbase.pp"/>
|
||||
@ -213,127 +206,11 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit24>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<JumpHistory Count="1">
|
||||
<Position1>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="612" TopLine="591"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="624" TopLine="620"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="626" TopLine="620"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="627" TopLine="620"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="629" TopLine="620"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="632" TopLine="620"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="633" TopLine="620"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="635" TopLine="620"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="638" TopLine="620"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="639" TopLine="620"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="640" TopLine="620"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="648" TopLine="635"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="650" TopLine="635"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="651" TopLine="635"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="652" TopLine="635"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="666" TopLine="653"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="673" TopLine="653"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="676" TopLine="667"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="677" TopLine="667"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="678" TopLine="667"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="679" TopLine="667"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="680" TopLine="667"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="681" TopLine="667"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="682" TopLine="667"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="683" TopLine="667"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<Caret Line="685" TopLine="667"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="204" Column="63" TopLine="19"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="C:\lazarus\lcl\forms.pp"/>
|
||||
<Caret Line="750" Column="3" TopLine="728"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="C:\lazarus\lcl\forms.pp"/>
|
||||
<Caret Line="445" Column="50" TopLine="408"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm_dyn.pas"/>
|
||||
<Caret Line="17" Column="23"/>
|
||||
</Position30>
|
||||
</Position1>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -59,13 +59,13 @@ uses
|
||||
const
|
||||
CEF_SUPPORTED_VERSION_MAJOR = 3;
|
||||
CEF_SUPPORTED_VERSION_MINOR = 3578;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 1860;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 1863;
|
||||
CEF_SUPPORTED_VERSION_BUILD = 0;
|
||||
|
||||
CEF_CHROMEELF_VERSION_MAJOR = 71;
|
||||
CEF_CHROMEELF_VERSION_MINOR = 0;
|
||||
CEF_CHROMEELF_VERSION_RELEASE = 3578;
|
||||
CEF_CHROMEELF_VERSION_BUILD = 80;
|
||||
CEF_CHROMEELF_VERSION_BUILD = 98;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
LIBCEF_DLL = 'libcef.dll';
|
||||
|
Loading…
x
Reference in New Issue
Block a user