1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-05-13 21:46:53 +02:00

Merge pull request #355 from User4martin/fpc-work-6

Fpc work 6
This commit is contained in:
Salvador Díaz Fau 2021-03-22 10:27:10 +01:00 committed by GitHub
commit 5d7183a711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 394 additions and 310 deletions

View File

@ -51,7 +51,7 @@ unit GlobalCefApplication;
interface
uses
uCEFApplication, uCEFWorkScheduler, uCEFLazApplication, FileUtil;
uCEFApplication, uCEFWorkScheduler, FileUtil;
procedure CreateGlobalCEFApp;
@ -75,8 +75,8 @@ begin
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
{$ENDIF}
GlobalCEFApp := TCefLazApplication.Create;
GlobalCEFApp.CheckCEFFiles := False;
GlobalCEFApp := TCefApplication.Create;
//GlobalCEFApp.CheckCEFFiles := False;
{$IFDEF USE_MULTI_THREAD_LOOP}
// On Windows/Linux CEF can use threads for the message-loop
GlobalCEFApp.MultiThreadedMessageLoop := True;

View File

@ -61,14 +61,14 @@ object Form1: TForm1
Text = 'https://www.google.com'
end
end
object LazarusBrowserWindow1: TLazarusBrowserWindow
object BrowserWindow1: TBrowserWindow
Left = 0
Height = 566
Top = 23
Width = 967
Align = alClient
TabOrder = 1
OnBrowserCreated = LazarusBrowserWindow1BrowserCreated
OnBrowserClosed = LazarusBrowserWindow1BrowserClosed
OnBrowserCreated = BrowserWindow1BrowserCreated
OnBrowserClosed = BrowserWindow1BrowserClosed
end
end

View File

@ -48,7 +48,7 @@ uses
SysUtils, Messages, Forms, Controls,
Dialogs, ExtCtrls, StdCtrls, LMessages,
uCEFTypes, uCEFInterfaces,
uCEFWorkScheduler, uCEFLazarusBrowserWindow, Classes;
uCEFWorkScheduler, uCEFBrowserWindow;
type
@ -58,7 +58,7 @@ type
AddressEdt: TComboBox;
GoBtn: TButton;
AddressPnl: TPanel;
LazarusBrowserWindow1: TLazarusBrowserWindow;
BrowserWindow1: TBrowserWindow;
procedure 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 extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
@ -66,8 +66,8 @@ type
procedure FormCreate(Sender: TObject);
procedure GoBtnClick(Sender: TObject);
procedure LazarusBrowserWindow1BrowserClosed(Sender: TObject);
procedure LazarusBrowserWindow1BrowserCreated(Sender: TObject);
procedure BrowserWindow1BrowserClosed(Sender: TObject);
procedure BrowserWindow1BrowserCreated(Sender: TObject);
protected
{$IFDEF WINDOWS}
@ -117,15 +117,15 @@ uses
procedure TForm1.GoBtnClick(Sender: TObject);
begin
LazarusBrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
BrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
end;
procedure TForm1.LazarusBrowserWindow1BrowserClosed(Sender: TObject);
procedure TForm1.BrowserWindow1BrowserClosed(Sender: TObject);
begin
Close;
end;
procedure TForm1.LazarusBrowserWindow1BrowserCreated(Sender: TObject);
procedure TForm1.BrowserWindow1BrowserCreated(Sender: TObject);
begin
Caption := 'BrowserWindow';
end;
@ -169,14 +169,14 @@ end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
LazarusBrowserWindow1.CloseBrowser(True);
BrowserWindow1.CloseBrowser(True);
CanClose := LazarusBrowserWindow1.IsClosed;
CanClose := BrowserWindow1.IsClosed;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
LazarusBrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
BrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
end;
initialization

View File

@ -51,7 +51,7 @@ unit GlobalCefApplication;
interface
uses
uCEFApplication, uCEFWorkScheduler, uCEFLazApplication, FileUtil,
uCEFApplication, uCEFWorkScheduler, FileUtil,
uHelperProcessDom;
procedure CreateGlobalCEFApp;
@ -76,8 +76,8 @@ begin
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
{$ENDIF}
GlobalCEFApp := TCefLazApplication.Create;
GlobalCEFApp.CheckCEFFiles := False;
GlobalCEFApp := TCefApplication.Create;
//GlobalCEFApp.CheckCEFFiles := False;
{$IFDEF USE_MULTI_THREAD_LOOP}
// On Windows/Linux CEF can use threads for the message-loop
GlobalCEFApp.MultiThreadedMessageLoop := True;

View File

@ -61,13 +61,13 @@ object Form1: TForm1
Text = 'https://www.google.com'
end
end
object LazarusBrowserWindow1: TLazarusBrowserWindow
object BrowserWindow1: TBrowserWindow
Left = 0
Height = 566
Top = 23
Width = 967
Align = alClient
TabOrder = 1
OnBrowserClosed = LazarusBrowserWindow1BrowserClosed
OnBrowserClosed = BrowserWindow1BrowserClosed
end
end

View File

@ -48,7 +48,7 @@ uses
SysUtils, Messages, Forms, Controls,
Dialogs, ExtCtrls, StdCtrls, LMessages, Menus,
uCEFTypes, uCEFInterfaces, uHelperProcessDom,
uCEFWorkScheduler, uCEFLazarusBrowserWindow, uCEFProcessMessage, Classes;
uCEFWorkScheduler, uCEFBrowserWindow, uCEFProcessMessage, Classes;
type
@ -58,7 +58,7 @@ type
AddressEdt: TComboBox;
GoBtn: TButton;
AddressPnl: TPanel;
LazarusBrowserWindow1: TLazarusBrowserWindow;
BrowserWindow1: TBrowserWindow;
mDomHere: TMenuItem;
procedure 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 extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
@ -67,7 +67,7 @@ type
procedure FormCreate(Sender: TObject);
procedure GoBtnClick(Sender: TObject);
procedure LazarusBrowserWindow1BrowserClosed(Sender: TObject);
procedure BrowserWindow1BrowserClosed(Sender: TObject);
private
FContextXY: TPoint;
@ -130,10 +130,10 @@ uses
procedure TForm1.GoBtnClick(Sender: TObject);
begin
LazarusBrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
BrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
end;
procedure TForm1.LazarusBrowserWindow1BrowserClosed(Sender: TObject);
procedure TForm1.BrowserWindow1BrowserClosed(Sender: TObject);
begin
Close;
end;
@ -149,7 +149,7 @@ end;
procedure TForm1.DoCaptureMenuXY;
begin
FContextXY := LazarusBrowserWindow1.ScreenToClient(Mouse.CursorPos);
FContextXY := BrowserWindow1.ScreenToClient(Mouse.CursorPos);
end;
procedure TForm1.DoContextMenuCmd(Sender: TObject; const browser: ICefBrowser;
@ -163,7 +163,7 @@ begin
TempMsg := TCefProcessMessageRef.New(MSG_REQUEST_DOM); // Same name than TCefCustomRenderProcessHandler.MessageName
TempMsg.ArgumentList.SetInt(0, FContextXY.X);
TempMsg.ArgumentList.SetInt(1, FContextXY.Y);
LazarusBrowserWindow1.Chromium.SendProcessMessage(PID_RENDERER, TempMsg);
BrowserWindow1.Chromium.SendProcessMessage(PID_RENDERER, TempMsg);
end;
end;
@ -220,18 +220,18 @@ end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
LazarusBrowserWindow1.CloseBrowser(True);
BrowserWindow1.CloseBrowser(True);
CanClose := LazarusBrowserWindow1.IsClosed;
CanClose := BrowserWindow1.IsClosed;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
LazarusBrowserWindow1.Chromium.OnBeforeContextMenu := @DoBeforeContextMenu;
LazarusBrowserWindow1.Chromium.OnContextMenuCommand := @DoContextMenuCmd;
LazarusBrowserWindow1.Chromium.OnProcessMessageReceived := @DoProcessMessageReceived;
BrowserWindow1.Chromium.OnBeforeContextMenu := @DoBeforeContextMenu;
BrowserWindow1.Chromium.OnContextMenuCommand := @DoContextMenuCmd;
BrowserWindow1.Chromium.OnProcessMessageReceived := @DoProcessMessageReceived;
LazarusBrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
BrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
end;
initialization

View File

@ -86,7 +86,7 @@ begin
GlobalCEFApp.OnScheduleMessagePumpWork := @GlobalCEFApp_OnScheduleMessagePumpWork;
{$ENDIF}
GlobalCEFApp.CheckCEFFiles := false;
//GlobalCEFApp.CheckCEFFiles := false;
{$IFnDEF MACOSX}
{$IFDEF USE_APP_HELPER}

View File

@ -48,7 +48,7 @@ uses
SysUtils, Messages, Forms, Controls,
Dialogs, ExtCtrls, StdCtrls, LMessages, Buttons,
uCEFTypes, uCEFInterfaces,
uCEFWorkScheduler, uCEFLazarusBrowserWindow, Classes;
uCEFWorkScheduler, uCEFBrowserWindow, Classes;
type
@ -98,7 +98,7 @@ type
procedure MaybeTerminateApp(Sender: TObject);
procedure MaybeCloseApp(Sender: TObject);
protected
FBrowserLeft, FBrowserRight: TLazarusBrowserWindow;
FBrowserLeft, FBrowserRight: TBrowserWindow;
FClosingBrowsers: TList;
{$IFDEF WINDOWS}
@ -150,7 +150,7 @@ uses
procedure TForm1.OpenBtnLeftClick(Sender: TObject);
begin
FBrowserLeft := TLazarusBrowserWindow.Create(Self);
FBrowserLeft := TBrowserWindow.Create(Self);
FBrowserLeft.Chromium.OnBeforePopup := @Chromium1BeforePopup;
FBrowserLeft.Chromium.OnOpenUrlFromTab := @Chromium1OpenUrlFromTab;
FBrowserLeft.OnBrowserCreated := @LeftBrowserCreated;
@ -191,7 +191,7 @@ end;
procedure TForm1.OpenBtnRightClick(Sender: TObject);
begin
FBrowserRight := TLazarusBrowserWindow.Create(Self);
FBrowserRight := TBrowserWindow.Create(Self);
FBrowserRight.Chromium.OnBeforePopup := @Chromium1BeforePopup;
FBrowserRight.Chromium.OnOpenUrlFromTab := @Chromium1OpenUrlFromTab;
FBrowserRight.OnBrowserCreated := @RightBrowserCreated;

View File

@ -51,7 +51,7 @@ unit GlobalCefApplication;
interface
uses
uCEFApplication, uCEFWorkScheduler, uCEFLazApplication, FileUtil,
uCEFApplication, uCEFWorkScheduler, FileUtil,
uHelperProcessDom;
procedure CreateGlobalCEFApp;
@ -76,8 +76,8 @@ begin
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
{$ENDIF}
GlobalCEFApp := TCefLazApplication.Create;
GlobalCEFApp.CheckCEFFiles := False;
GlobalCEFApp := TCefApplication.Create;
//GlobalCEFApp.CheckCEFFiles := False;
{$IFDEF USE_MULTI_THREAD_LOOP}
// On Windows/Linux CEF can use threads for the message-loop
GlobalCEFApp.MultiThreadedMessageLoop := True;
@ -88,8 +88,6 @@ begin
GlobalCEFApp.OnScheduleMessagePumpWork := @GlobalCEFApp_OnScheduleMessagePumpWork;
{$ENDIF}
GlobalCEFApp.CheckCEFFiles := false;
{$IFnDEF MACOSX}
{$IFDEF USE_APP_HELPER}
(* Use AppHelper as subprocess, instead of the main exe *)

View File

@ -61,7 +61,7 @@ object Form1: TForm1
Text = 'https://www.google.com'
end
end
object LazarusOsrBrowserWindow1: TLazarusOsrBrowserWindow
object OsrBrowserWindow1: TOsrBrowserWindow
Left = 0
Height = 566
Top = 23
@ -69,8 +69,8 @@ object Form1: TForm1
CopyOriginalBuffer = True
Align = alClient
TabOrder = 1
OnMouseMove = LazarusOsrBrowserWindow1MouseMove
OnBrowserClosed = LazarusBrowserWindow1BrowserClosed
OnMouseMove = OsrBrowserWindow1MouseMove
OnBrowserClosed = OsrBrowserWindow1BrowserClosed
end
object PopupMenu1: TPopupMenu
left = 418

View File

@ -47,8 +47,8 @@ uses
uCEFLazarusCocoa, // required for Cocoa
SysUtils, Messages, Forms, Controls, Dialogs, ExtCtrls, StdCtrls, LMessages,
Menus, Graphics, uCEFTypes, uCEFInterfaces, uHelperProcessDom,
uCEFWorkScheduler, uCEFLazarusBrowserWindow, uCEFProcessMessage,
uCEFLazarusOsrBrowserWindow, Classes;
uCEFWorkScheduler, uCEFBrowserWindow, uCEFProcessMessage,
uCEFOsrBrowserWindow, Classes;
type
@ -58,7 +58,7 @@ type
AddressEdt: TComboBox;
GoBtn: TButton;
AddressPnl: TPanel;
LazarusOsrBrowserWindow1: TLazarusOsrBrowserWindow;
OsrBrowserWindow1: TOsrBrowserWindow;
mDomHere: TMenuItem;
MenuItem1: TMenuItem;
PopupMenu1: TPopupMenu;
@ -69,8 +69,8 @@ type
procedure FormCreate(Sender: TObject);
procedure GoBtnClick(Sender: TObject);
procedure LazarusBrowserWindow1BrowserClosed(Sender: TObject);
procedure LazarusOsrBrowserWindow1MouseMove(Sender: TObject;
procedure OsrBrowserWindow1BrowserClosed(Sender: TObject);
procedure OsrBrowserWindow1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
private
FCurRect: TRect;
@ -109,15 +109,15 @@ uses
procedure TForm1.GoBtnClick(Sender: TObject);
begin
LazarusOsrBrowserWindow1.Chromium.LoadURL(UTF8Decode(AddressEdt.Text));
OsrBrowserWindow1.Chromium.LoadURL(UTF8Decode(AddressEdt.Text));
end;
procedure TForm1.LazarusBrowserWindow1BrowserClosed(Sender: TObject);
procedure TForm1.OsrBrowserWindow1BrowserClosed(Sender: TObject);
begin
Close;
end;
procedure TForm1.LazarusOsrBrowserWindow1MouseMove(Sender: TObject;
procedure TForm1.OsrBrowserWindow1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
TempMsg : ICefProcessMessage;
@ -125,7 +125,7 @@ begin
TempMsg := TCefProcessMessageRef.New(MSG_REQUEST_DOM_R); // Same name than TCefCustomRenderProcessHandler.MessageName
TempMsg.ArgumentList.SetInt(0, X);
TempMsg.ArgumentList.SetInt(1, Y);
LazarusOsrBrowserWindow1.Chromium.SendProcessMessage(PID_RENDERER, TempMsg);
OsrBrowserWindow1.Chromium.SendProcessMessage(PID_RENDERER, TempMsg);
end;
procedure TForm1.DoOnMouseDown(Sender: TObject; Button: TMouseButton;
@ -147,10 +147,10 @@ end;
procedure TForm1.DoOnPaint(Sender: TObject);
begin
if (FCurRect.Width > 0) and (FCurRect.Height > 0) then begin
LazarusOsrBrowserWindow1.Canvas.Brush.Style := bsClear;
LazarusOsrBrowserWindow1.Canvas.Pen.Style := psSolid;
LazarusOsrBrowserWindow1.Canvas.Pen.Color := clRed;
LazarusOsrBrowserWindow1.Canvas.Rectangle(FCurRect);
OsrBrowserWindow1.Canvas.Brush.Style := bsClear;
OsrBrowserWindow1.Canvas.Pen.Style := psSolid;
OsrBrowserWindow1.Canvas.Pen.Color := clRed;
OsrBrowserWindow1.Canvas.Rectangle(FCurRect);
end;
end;
@ -167,7 +167,7 @@ begin
FCurRect.Width := message.ArgumentList.GetInt(2);
FCurRect.Height := message.ArgumentList.GetInt(3);
Result := True;
LazarusOsrBrowserWindow1.Invalidate;
OsrBrowserWindow1.Invalidate;
end;
end;
end;
@ -194,10 +194,10 @@ begin
if (GlobalCEFApp <> nil) then
GlobalCEFApp.UpdateDeviceScaleFactor;
if (LazarusOsrBrowserWindow1.Chromium <> nil) then
if (OsrBrowserWindow1.Chromium <> nil) then
begin
LazarusOsrBrowserWindow1.Chromium.NotifyScreenInfoChanged;
LazarusOsrBrowserWindow1.Chromium.WasResized;
OsrBrowserWindow1.Chromium.NotifyScreenInfoChanged;
OsrBrowserWindow1.Chromium.WasResized;
end;
end;
@ -226,20 +226,20 @@ end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
LazarusOsrBrowserWindow1.CloseBrowser(True);
OsrBrowserWindow1.CloseBrowser(True);
CanClose := LazarusOsrBrowserWindow1.IsClosed;
CanClose := OsrBrowserWindow1.IsClosed;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FCurRect.Width := 0;
LazarusOsrBrowserWindow1.Chromium.OnProcessMessageReceived := @DoProcessMessageReceived;
LazarusOsrBrowserWindow1.OnMouseDown := @DoOnMouseDown;
LazarusOsrBrowserWindow1.OnMouseUp := @DoOnMouseUp;
LazarusOsrBrowserWindow1.OnPaint := @DoOnPaint;
OsrBrowserWindow1.Chromium.OnProcessMessageReceived := @DoProcessMessageReceived;
OsrBrowserWindow1.OnMouseDown := @DoOnMouseDown;
OsrBrowserWindow1.OnMouseUp := @DoOnMouseUp;
OsrBrowserWindow1.OnPaint := @DoOnPaint;
LazarusOsrBrowserWindow1.Chromium.LoadURL(UTF8Decode(AddressEdt.Text));
OsrBrowserWindow1.Chromium.LoadURL(UTF8Decode(AddressEdt.Text));
end;
initialization

View File

@ -22,7 +22,7 @@
<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="89" Release="7"/>
<Files Count="202">
<Files Count="201">
<Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
<UnitName Value="uCEFAccessibilityHandler"/>
@ -833,22 +833,18 @@
</Item198>
<Item199>
<Filename Value="..\source\uceflazaruscocoa.pas"/>
<UnitName Value="uceflazaruscocoa"/>
<UnitName Value="uCEFLazarusCocoa"/>
</Item199>
<Item200>
<Filename Value="..\source\uceflazarusbrowserwindow.pas"/>
<Filename Value="..\source\uCEFBrowserWindow.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="uceflazarusbrowserwindow"/>
<UnitName Value="uCEFBrowserWindow"/>
</Item200>
<Item201>
<Filename Value="..\source\uCEFLazApplication.pas"/>
<UnitName Value="uCEFLazApplication"/>
</Item201>
<Item202>
<Filename Value="..\source\uCEFLazarusOsrBrowserWindow.pas"/>
<Filename Value="..\source\uCEFOsrBrowserWindow.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="uCEFLazarusOsrBrowserWindow"/>
</Item202>
<UnitName Value="uCEFOsrBrowserWindow"/>
</Item201>
</Files>
<CompatibilityMode Value="True"/>
<RequiredPkgs Count="5">

View File

@ -66,8 +66,7 @@ uses
uCEFPrintDialogCallback, uCEFPrintHandler, uCEFPrintJobCallback,
uCEFLinuxFunctions, uCEFLinuxTypes, uCEFLinuxConstants,
uCEFWorkSchedulerQueueThread, uCEFLinkedWinControlBase, uCEFLazarusCocoa,
uCEFLazarusBrowserWindow, uCEFLazApplication, uCEFLazarusOsrBrowserWindow,
LazarusPackageIntf;
uCEFBrowserWindow, uCEFOsrBrowserWindow, LazarusPackageIntf;
implementation
@ -90,9 +89,8 @@ begin
RegisterUnit('uCEFPanelComponent', @uCEFPanelComponent.Register);
RegisterUnit('uCEFScrollViewComponent', @uCEFScrollViewComponent.Register);
RegisterUnit('uCEFTextfieldComponent', @uCEFTextfieldComponent.Register);
RegisterUnit('uCEFLazarusBrowserWindow', @uCEFLazarusBrowserWindow.Register);
RegisterUnit('uCEFLazarusOsrBrowserWindow',
@uCEFLazarusOsrBrowserWindow.Register);
RegisterUnit('uCEFBrowserWindow', @uCEFBrowserWindow.Register);
RegisterUnit('uCEFOsrBrowserWindow', @uCEFOsrBrowserWindow.Register);
end;
initialization

View File

@ -0,0 +1,38 @@
LazarusResources.Add('tlazarusbrowserwindow','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#2#0#0#0'o'#21#170#175
+#0#0#0#9'pHYs'#0#0#13#215#0#0#13#215#1'B('#155'x'#0#0#0#7'tIME'#7#226#5#11#10
+#31#18#187#205#226'X'#0#0#3#10'IDAT8'#203#173#149'Ml'#27'U'#16#199'g'#158'7'
+#222#197'Qk'#183'IIBl#'#156'JM'#12'V'#137#168#16'E *8Qn'#17' '#142#168#226
+#200#181#189'p'#228#128#212'['#213#3'\'#171#194#165'= TQ'#129'P'#131#26#138
+'d'#167#20'PE'#212'H'#9'_'#18'i'#226#218#241'G'#214'~'#187#222'}3'#195'a#w'
+#243'Q)'#144#206'i5o'#222'_3'#191#153'y'#139'"'#2#143#195','#215'u'#23#23#23
+#247#169'R,'#22#161'\.'#19#145#236#195#136#168'\.+"RJ'#237''''#29#165#20#17
+#237'I'#162'g'#246#192#232'Q'#7'k.\-'#223#191#241#253'M'#1#4#128#4#192#169
+#215'_}'#231#197#241#177#131#143#22'b'#230'm'#222'Oo5'#191#190'v'#205'NZ'#153
+'L'#26#5#1#128#133'ggg'#175'_'#15#222#255#224#204#187#147#187'4Z'#1#128#136
+'p'#204'.'#220'l^'#186#252#133#149't'#208'Jv'#180#239'j'#175#165#187#237#142
+'6'#146#224'D'#242#147#243#23#206']Y'#142#199'G'#3#180#153'Q'#127#154'j'#30
+#206#207#223'N$'#157#182#246#200#176#31#154#227#133#209#3#169#228'j'#203#183
+#5#6#149#12#165#7#239#222#254'a'#253#244'3'#135#156#205'+'#136#184')'#20'e'
+#20'y'#231#254#30'('#30'+'#212'j'#235'n'#167'{4w'#248#243#143#222'^m'#19#139
+'d3'#214#221#127#186':'#228#148'm'#245#180'k'#148'b'#14#251']'#3#0'+R!'#162
+#200'['#249'y!?>'#246#236'sS_~'#245#237#220#197'3'#31'_Y'#178#7#20'"z~xvfb'
+#249#129#7#28#218#142#179#244#231#253'L'#225'p'#31#144#136#168#168#180'X'#193
+'@l'#242#217#209#247'N'#191#242#203#239#27#141#166#214':'#208#186#215'r{'#183
+'~'#171#167#146#9'f'#16#129'-P'#153'w)'#141'X'#136#152#133#166'&'''#218#186
+'Wk{'#134#24#17'Z:'#232#6#6#128#1#0#1#12#131'!V'#24'+'#173#159'Q$'#20#132#20
+#24#177'mY'#217#8'_'#155#28'Zu'#189#7']'#31#1#12'K'#169#144#209#1'#'#2#3#244
+#136'@'#152#5#250#211'cE*}F'''#166#167#23#238'-'#140#28'9d)u'#227#158#251#217
+#135'/|sgMD'#222'x~'#196'0'#136#0' 4'#154#237'\6K'#180#209#135#205#204#219#25
+#189'<'#214#233't}'#207'7'#134#184#222#9#175#222'i'#13#13#165#237#212#224#210
+#154'oH'#16' 4'#208#236#132#25#232'lc'#180'} '#135#147#193'K'''#166'W'#170'u'
+#207#15'{'#129#17#162#229#170'n'#235#224#216'S'#131'!'#177#14#229#143#149'Zv'
+'|'#212#134'`'#247#129#140'o'#201'['#185#134#147'(}'#247#227#175#169''''#236
+'t'#250'`h'#248#228#241#225#182'G'#213'zk'#221#13#158#206#231'rV3'#190'T'#15
+#187#22'g'#20#217#169#145'F'#241#205#137#185'j'#166'2'#255#211#147#233#129
+#191'V'#209#13'h'#234'h'#225#228#145#214#1#171#190'5v'#171#208#206#189#29#182
+'{3'#249#234'L>'#23#243'U'#1'`G <d'#244'x'#222#236' '#8#148'R'#142#227#252'o'
+#9'D'#212'Zc'#163#209#168'T*'#158#231#25'c'#254#235#31#5#17#17#209'q'#156'R'
+#169#132#241#203';I'#237#229#193#142'>'#254#5'Ixq'#26'FW'#221'b'#0#0#0#0'IEN'
+'D'#174'B`'#130
]);

View File

@ -60,7 +60,11 @@ uses
{$ENDIF}
System.Classes, System.UITypes,
{$ELSE}
{$IFDEF MSWINDOWS}Windows, Forms, ActiveX,{$ENDIF} Classes, Controls, {$IFDEF FPC}dynlibs,{$ENDIF}
Forms,
{$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF} Classes, Controls, {$IFDEF FPC}dynlibs,{$ENDIF}
{$ENDIF}
{$IFDEF FPC}
LCLProc,
{$ENDIF}
uCEFApplicationCore, uCEFTypes;
@ -83,6 +87,12 @@ type
protected
FDestroyApplicationObject : boolean;
FDestroyAppWindows : boolean;
{$IFDEF FPC}
FContextInitializedHandlers: TMethodList;
FContextInitializedDone: Boolean;
procedure CallContextInitializedHandlers(Data: PtrInt);
{$ENDIF}
procedure BeforeInitSubProcess; override;
@ -93,6 +103,13 @@ type
property DestroyApplicationObject: boolean read FDestroyApplicationObject write FDestroyApplicationObject;
property DestroyAppWindows : boolean read FDestroyAppWindows write FDestroyAppWindows;
{$IFDEF FPC}
procedure Internal_OnContextInitialized; override; // In UI thread
Procedure AddContextInitializedHandler(AHandler: TNotifyEvent);
Procedure RemoveContextInitializedHandler(AHandler: TNotifyEvent);
{$ENDIF}
end;
TCEFDirectoryDeleterThread = uCEFApplicationCore.TCEFDirectoryDeleterThread;
@ -187,6 +204,10 @@ end;
constructor TCefApplication.Create;
begin
{$IFDEF FPC}
FContextInitializedHandlers := TMethodList.Create;
{$ENDIF}
inherited Create;
if GlobalCEFApp = nil then
GlobalCEFApp := Self;
@ -200,6 +221,10 @@ begin
if GlobalCEFApp = Self then
GlobalCEFApp := nil;
inherited Destroy;
{$IFDEF FPC}
FContextInitializedHandlers.Free;
{$ENDIF}
end;
procedure TCefApplication.UpdateDeviceScaleFactor;
@ -238,6 +263,34 @@ begin
{$ENDIF}
end;
{$IFDEF FPC}
procedure TCefApplication.Internal_OnContextInitialized;
begin
inherited Internal_OnContextInitialized;
Application.QueueAsyncCall(@CallContextInitializedHandlers, 0);
end;
procedure TCefApplication.AddContextInitializedHandler(AHandler: TNotifyEvent);
begin
FContextInitializedHandlers.Add(TMethod(AHandler));
if FContextInitializedDone then
AHandler(Self);
end;
procedure TCefApplication.RemoveContextInitializedHandler(AHandler: TNotifyEvent);
begin
FContextInitializedHandlers.Remove(TMethod(AHandler));
end;
{$ENDIF}
{$IFDEF FPC}
procedure TCefApplication.CallContextInitializedHandlers(Data: PtrInt);
begin
FContextInitializedHandlers.CallNotifyEvents(Self);
FContextInitializedDone := True;
end;
{$ENDIF}
procedure TCefApplication.BeforeInitSubProcess;
{$IFNDEF FPC}
{$IFNDEF FMX}

View File

@ -35,7 +35,7 @@
*
*)
unit uCEFLazarusBrowserWindow;
unit uCEFBrowserWindow;
{$mode objfpc}{$H+}
{$i cef.inc}
@ -47,7 +47,7 @@ uses
LResources, PropEdits,
{$ENDIF}
uCEFApplication, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces, uCEFChromium,
uCEFLinkedWinControlBase, uCEFLazApplication, uCEFBrowserViewComponent,
uCEFLinkedWinControlBase, uCEFBrowserViewComponent,
uCEFChromiumEvents, Forms, ExtCtrls, Controls, Classes, sysutils;
type
@ -57,14 +57,26 @@ type
only close once that event was finished.
*)
{ TLazChromium }
{ TEmbeddedChromium
TLazChromium = class(TChromium)
1) TEmbeddedChromium keeps track of the browser while it is created.
This allows for CloseBrowser to function, even if the Browser object is not
yet known.
Also calls to "LoadUrl" are cached until the browser object is created.
2) TEmbeddedChromium adds InternalEvents that can be hooked by the
component that owns the TEmbeddedChromium.
This means the default published events are available to the end user.
Published events that should not be available are hidden via THiddenPropertyEditor
* Hidden event properties must not be assigned by any end user code. *
}
TEmbeddedChromium = class(TChromium)
private type
TLazChromiumState = (csNoBrowser, csCreatingBrowser, csHasBrowser, csClosingBrowser, csCloseAfterCreate);
TChromiumBrowserState = (csNoBrowser, csCreatingBrowser, csHasBrowser, csClosingBrowser, csCloseAfterCreate);
private
FInternalOnGotFocus: TOnGotFocus;
FState : TLazChromiumState;
FState : TChromiumBrowserState;
FInternalOnBrowserClosed : TNotifyEvent;
FInternalOnBrowserCreated : TNotifyEvent;
@ -108,7 +120,8 @@ type
property HasBrowser: Boolean read GetHasBrowser; // Includes browser in creation
property IsClosing : Boolean read GetIsClosing;
(* - Events to be called in main thread
(* - Events for use by the Owning component ONLY
- Events are called in main thread
- OnBrowserCreated: the parent event may be called when procedure Initialized is still false.
- OnBrowserCreated: may not be called, if the CloseBrowser has already been called
*)
@ -117,7 +130,7 @@ type
property InternalOnGotFocus : TOnGotFocus read FInternalOnGotFocus write FInternalOnGotFocus;
end;
TLazarusBrowserWindow = class;
TBrowserWindow = class;
{ TChromiumWrapper }
@ -125,9 +138,9 @@ type
protected type
TWrapperState = (wsNone, wsWaitingForClose, wsSentCloseEventAfterWait, wsDestroyAfterWait);
protected
FChromium : TLazChromium;
FChromium : TEmbeddedChromium;
FWrapperState : TWrapperState;
FBrowserWindow : TLazarusBrowserWindow;
FBrowserWindow : TBrowserWindow;
procedure DoOnAfterCreated(Sender: TObject);
procedure DoOnBeforeClose(Sender: TObject);
@ -139,7 +152,7 @@ type
procedure MaybeDestroy;
public
constructor Create(AOwner: TLazarusBrowserWindow); reintroduce;
constructor Create(AOwner: TBrowserWindow); reintroduce;
destructor Destroy; override;
function CreateBrowser: boolean;
@ -147,23 +160,64 @@ type
procedure CloseBrowser(aForceClose: boolean);
function IsClosed: boolean;
(* WaitForBrowserClosed calls ProcessMessages.
It therefore is possible that the TLazarusBrowserWindow will be destroyed
It therefore is possible that the TBrowserWindow will be destroyed
when this method returns.
It is the callers responsibility to take any necessary precaution.
*)
procedure WaitForBrowserClosed;
published
property Chromium: TLazChromium read FChromium;
property Chromium: TEmbeddedChromium read FChromium;
end;
{ TLazarusBrowserWindow }
{ TBrowserWindow
(* On MacOs TLazarusBrowserWindow must wait for OnBrowserClosed before it can
be destroyed or before its handle can be closed
*)
A simple "drop on the Form" component for an full embedded browser.
TLazarusBrowserWindow = class(TCEFLinkedWinControlBase)
The component handles most events required by CEF.
The only additions needed to be made by the User in their code are:
* Implement TForm.OnCloseQuery
CEF must be able to destroy the browser, before the main form is closed.
(That is while the Form still has a Handle, and the event loop is still
running)
It is adviced to do the same for any other form (other than the main form).
TForm.OnCloseQuery should call (for each TBrowserWindow)
TBrowserWindow.CloseBrowser(True);
The Form can be allowed to close by setting (checking for all BrowserWindows)
CanClose := BrowserWindow.IsClosed;
On Windows and Linux it is also possible to Destroy the TBrowserWindow.
This will wait for the browser to close, and after that the form can be closed.
- However, this must be done in OnCloseQuery (or before).
- Once TForm.Destroy is called, it is to late. By that time the event loop
no longer runs.
*** IMPORTANT: (MacOS) ***
On MacOs CloseBrowser() must be called, and the *event* must be awaited.
Neither destroying the component, nor waiting with App.ProcessMessages will
work.
On MacOS, CEF will not finish until the OnCloseQuery event returned to the
main event loop. (Hence ProcessMessage does not work).
The same is true for any action taken in OnClick or other event.
CEF always waits for any event to return to the main event loop.
See also the BrowserWindowEX example how that affect modal forms.
* Implement TBrowserWindow.OnBrowserClosed
If TForm.OnCloseQuery called CloseBrowser, this callback can be used to
call Form.Close again (the callback should check if the browser was
closed by OnCloseQuery.
* On Windows:
handle the WM_ENTERMENULOOP and WM_EXITMENULOOP, as shown in examples
* Optional prevent pop-up windows by implementing
Chromium.BeforePopup
Chromium.OpenUrlFromTab
}
TBrowserWindow = class(TCEFLinkedWinControlBase)
private
FChromiumWrapper : TChromiumWrapper;
@ -173,7 +227,7 @@ type
procedure DoCreateBrowser(Sender: TObject);
procedure DoCreateBrowserAfterContext(Sender: TObject);
function GetLazChromium: TLazChromium;
function GetEmbeddedChromium: TEmbeddedChromium;
protected
function GetChromium: TChromium; override;
procedure DestroyHandle; override;
@ -195,10 +249,10 @@ type
procedure LoadURL(aURL: ustring);
published
property Chromium: TLazChromium read GetLazChromium;
property Chromium: TEmbeddedChromium read GetEmbeddedChromium;
property OnBrowserCreated : TNotifyEvent read FOnBrowserCreated write FOnBrowserCreated;
(* OnBrowserClosed will not be called, if the TLazarusBrowserWindow is
(* OnBrowserClosed will not be called, if the TBrowserWindow is
destroyed/destroying before the browser is closed.
*)
property OnBrowserClosed : TNotifyEvent read FOnBrowserClosed write FOnBrowserClosed;
@ -210,24 +264,24 @@ procedure Register;
implementation
{ TLazChromium }
{ TEmbeddedChromium }
function TLazChromium.GetIsClosing: Boolean;
function TEmbeddedChromium.GetIsClosing: Boolean;
begin
Result := FState in [csCloseAfterCreate, csClosingBrowser];
end;
procedure TLazChromium.SetInternalOnClose(AValue: TOnClose);
procedure TEmbeddedChromium.SetInternalOnClose(AValue: TOnClose);
begin
inherited OnClose := AValue;
end;
function TLazChromium.GetHasBrowser: boolean;
function TEmbeddedChromium.GetHasBrowser: boolean;
begin
Result := (FState <> csNoBrowser) or (inherited GetHasBrowser);
end;
procedure TLazChromium.doOnBeforeClose(const ABrowser: ICefBrowser);
procedure TEmbeddedChromium.doOnBeforeClose(const ABrowser: ICefBrowser);
begin
inherited doOnBeforeClose(ABrowser);
@ -235,7 +289,7 @@ begin
Application.QueueAsyncCall(@DoOnClosed, 0);
end;
procedure TLazChromium.doOnAfterCreated(const ABrowser: ICefBrowser);
procedure TEmbeddedChromium.doOnAfterCreated(const ABrowser: ICefBrowser);
begin
inherited doOnAfterCreated(ABrowser);
(* We may still be in Chromium.CreateBrowserSync
@ -245,20 +299,20 @@ begin
Application.QueueAsyncCall(@DoCreated, 0);
end;
procedure TLazChromium.doOnGotFocus(const Abrowser: ICefBrowser);
procedure TEmbeddedChromium.doOnGotFocus(const Abrowser: ICefBrowser);
begin
inherited doOnGotFocus(Abrowser);
if Assigned(FInternalOnGotFocus) then
FInternalOnGotFocus(Self, Abrowser);
end;
function TLazChromium.MustCreateFocusHandler: boolean;
function TEmbeddedChromium.MustCreateFocusHandler: boolean;
begin
Result := assigned(FInternalOnGotFocus) or
inherited MustCreateFocusHandler;
end;
procedure TLazChromium.DoCreated(Data: PtrInt);
procedure TEmbeddedChromium.DoCreated(Data: PtrInt);
var
u, f: ustring;
begin
@ -282,25 +336,27 @@ begin
end;
end;
procedure TLazChromium.DoOnClosed(Data: PtrInt);
procedure TEmbeddedChromium.DoOnClosed(Data: PtrInt);
begin
if (FInternalOnBrowserClosed <> nil) then
FInternalOnBrowserClosed(Self);
end;
constructor TLazChromium.Create(AOwner: TComponent);
constructor TEmbeddedChromium.Create(AOwner: TComponent);
begin
FState := csNoBrowser;
inherited Create(AOwner);
SetSubComponent(True);
Name := 'Chromium';
end;
destructor TLazChromium.Destroy;
destructor TEmbeddedChromium.Destroy;
begin
inherited Destroy;
Application.RemoveAsyncCalls(Self);
end;
function TLazChromium.CreateBrowser(const aBrowserParent: TWinControl;
function TEmbeddedChromium.CreateBrowser(const aBrowserParent: TWinControl;
const aWindowName: ustring; const aContext: ICefRequestContext;
const aExtraInfo: ICefDictionaryValue): boolean;
begin
@ -311,7 +367,7 @@ begin
DoCreated(0);
end;
function TLazChromium.CreateBrowser(aParentHandle: TCefWindowHandle;
function TEmbeddedChromium.CreateBrowser(aParentHandle: TCefWindowHandle;
aParentRect: TRect; const aWindowName: ustring;
const aContext: ICefRequestContext; const aExtraInfo: ICefDictionaryValue): boolean;
begin
@ -322,7 +378,7 @@ begin
DoCreated(0);
end;
procedure TLazChromium.CreateBrowser(const aWindowName: ustring);
procedure TEmbeddedChromium.CreateBrowser(const aWindowName: ustring);
begin
FState := csCreatingBrowser;
inherited CreateBrowser(aWindowName);
@ -330,7 +386,7 @@ begin
DoCreated(0);
end;
function TLazChromium.CreateBrowser(const aURL: ustring;
function TEmbeddedChromium.CreateBrowser(const aURL: ustring;
const aBrowserViewComp: TCEFBrowserViewComponent;
const aContext: ICefRequestContext; const aExtraInfo: ICefDictionaryValue
): boolean;
@ -341,7 +397,7 @@ begin
DoCreated(0);
end;
procedure TLazChromium.CloseBrowser(aForceClose: boolean);
procedure TEmbeddedChromium.CloseBrowser(aForceClose: boolean);
begin
if FState = csCreatingBrowser then begin
FState := csCloseAfterCreate;
@ -355,7 +411,7 @@ begin
end;
end;
procedure TLazChromium.LoadURL(const aURL: ustring; const aFrameName: ustring);
procedure TEmbeddedChromium.LoadURL(const aURL: ustring; const aFrameName: ustring);
begin
FLoadUrl := '';
FFrameName := '';
@ -410,6 +466,8 @@ end;
procedure TChromiumWrapper.MaybeDestroy;
begin
if FChromium.Owner <> nil then
FBrowserWindow.RemoveComponent(FChromium);
CloseBrowser(True);
FBrowserWindow := nil;
@ -420,12 +478,12 @@ begin
Destroy;
end;
constructor TChromiumWrapper.Create(AOwner: TLazarusBrowserWindow);
constructor TChromiumWrapper.Create(AOwner: TBrowserWindow);
begin
FBrowserWindow := AOwner;
FWrapperState := wsNone;
FChromium := TLazChromium.Create(nil);
FChromium := TEmbeddedChromium.Create(AOwner);
if not(csDesigning in AOwner.ComponentState) then
begin
FChromium.OnClose := {$IFDEF FPC}@{$ENDIF}BrowserThread_OnClose;
@ -498,9 +556,9 @@ begin
FWrapperState := wsNone;
end;
{ TLazarusBrowserWindow }
{ TBrowserWindow }
procedure TLazarusBrowserWindow.DoCreateBrowser(Sender: TObject);
procedure TBrowserWindow.DoCreateBrowser(Sender: TObject);
begin
if FTimer <> nil then
FTimer.Enabled := False;
@ -531,7 +589,7 @@ begin
end;
end;
procedure TLazarusBrowserWindow.DoCreateBrowserAfterContext(Sender: TObject);
procedure TBrowserWindow.DoCreateBrowserAfterContext(Sender: TObject);
begin
{$IFnDEF WINDOWS}
FTimer := TTimer.Create(Self);
@ -543,17 +601,17 @@ begin
{$ENDIF}
end;
function TLazarusBrowserWindow.GetLazChromium: TLazChromium;
function TBrowserWindow.GetEmbeddedChromium: TEmbeddedChromium;
begin
Result := FChromiumWrapper.Chromium;
end;
function TLazarusBrowserWindow.GetChromium: TChromium;
function TBrowserWindow.GetChromium: TChromium;
begin
Result := FChromiumWrapper.FChromium;
end;
procedure TLazarusBrowserWindow.CreateHandle;
procedure TBrowserWindow.CreateHandle;
begin
inherited CreateHandle;
if not (csDesigning in ComponentState) then begin
@ -561,14 +619,11 @@ begin
But at least on Linux, we need to wait
*)
if GlobalCEFApp is TCefLazApplication then
TCefLazApplication(GlobalCEFApp).AddContextInitializedHandler(@DoCreateBrowserAfterContext)
else
DoCreateBrowserAfterContext(nil);
GlobalCEFApp.AddContextInitializedHandler(@DoCreateBrowserAfterContext);
end;
end;
procedure TLazarusBrowserWindow.DestroyHandle;
procedure TBrowserWindow.DestroyHandle;
begin
if FTimer <> nil then
FreeAndNil(FTimer);
@ -590,7 +645,7 @@ begin
{$ENDIF}
end;
procedure TLazarusBrowserWindow.RealizeBounds;
procedure TBrowserWindow.RealizeBounds;
begin
inherited RealizeBounds;
@ -598,20 +653,20 @@ begin
Chromium.NotifyMoveOrResizeStarted;
end;
procedure TLazarusBrowserWindow.DoEnter;
procedure TBrowserWindow.DoEnter;
begin
inherited DoEnter;
If not(csDesigning in ComponentState) then Chromium.SetFocus(True);
end;
procedure TLazarusBrowserWindow.DoExit;
procedure TBrowserWindow.DoExit;
begin
inherited DoExit;
if not(csDesigning in ComponentState) then
Chromium.SendCaptureLostEvent;
end;
procedure TLazarusBrowserWindow.DoOnCreated;
procedure TBrowserWindow.DoOnCreated;
begin
{$IFDEF FPC}{$IFDEF LINUX}
Chromium.UpdateXWindowVisibility(Visible);
@ -621,7 +676,7 @@ begin
FOnBrowserCreated(Self);
end;
procedure TLazarusBrowserWindow.DoOnClosed(Data: PtrInt);
procedure TBrowserWindow.DoOnClosed(Data: PtrInt);
begin
if (not(csDestroying in ComponentState)) and
Assigned(FOnBrowserClosed)
@ -629,40 +684,42 @@ begin
FOnBrowserClosed(Self);
end;
procedure TLazarusBrowserWindow.DoOnFocus(Data: PtrInt);
procedure TBrowserWindow.DoOnFocus(Data: PtrInt);
begin
SetFocus;
end;
constructor TLazarusBrowserWindow.Create(AOwner: TComponent);
constructor TBrowserWindow.Create(AOwner: TComponent);
begin
FChromiumWrapper := TChromiumWrapper.Create(Self);
inherited Create(AOwner);
ControlStyle := ControlStyle + [csOwnedChildrenNotSelectable];
end;
destructor TLazarusBrowserWindow.Destroy;
destructor TBrowserWindow.Destroy;
begin
RemoveComponent(FChromiumWrapper.FChromium);
inherited Destroy;
FChromiumWrapper.MaybeDestroy;
Application.RemoveAsyncCalls(Self);
end;
procedure TLazarusBrowserWindow.CloseBrowser(aForceClose: boolean);
procedure TBrowserWindow.CloseBrowser(aForceClose: boolean);
begin
FChromiumWrapper.CloseBrowser(aForceClose);
end;
procedure TLazarusBrowserWindow.WaitForBrowserClosed;
procedure TBrowserWindow.WaitForBrowserClosed;
begin
FChromiumWrapper.WaitForBrowserClosed;
end;
function TLazarusBrowserWindow.IsClosed: boolean;
function TBrowserWindow.IsClosed: boolean;
begin
Result := FChromiumWrapper.IsClosed;
end;
procedure TLazarusBrowserWindow.LoadURL(aURL: ustring);
procedure TBrowserWindow.LoadURL(aURL: ustring);
begin
FChromiumWrapper.LoadURL(aURL);
end;
@ -671,10 +728,10 @@ end;
procedure Register;
begin
{$I res/tlazarusbrowserwindow.lrs}
RegisterComponents('Chromium', [TLazarusBrowserWindow]);
RegisterPropertyEditor(ClassTypeInfo(TLazChromium), nil,'',TClassPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnClose), TLazChromium, 'OnClose', THiddenPropertyEditor);
{$I res/TBrowserWindow.lrs}
RegisterComponents('Chromium', [TBrowserWindow]);
RegisterClass(TEmbeddedChromium);
RegisterPropertyEditor(TypeInfo(TOnClose), TEmbeddedChromium, 'OnClose', THiddenPropertyEditor);
end;
{$ENDIF}

View File

@ -1,80 +0,0 @@
unit uCEFLazApplication;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
{$ELSE}
Forms, LclProc, Classes, SysUtils,
{$ENDIF}
uCEFTypes, uCEFApplication;
type
{ TCefLazApplication }
TCefLazApplication = class(TCefApplication)
protected
FContextInitializedHandlers: TMethodList;
FContextInitializedDone: Boolean;
procedure CallContextInitializedHandlers(Data: PtrInt);
public
constructor Create;
destructor Destroy; override;
procedure Internal_OnContextInitialized; override; // In UI thread
Procedure AddContextInitializedHandler(AHandler: TNotifyEvent);
Procedure RemoveContextInitializedHandler(AHandler: TNotifyEvent);
end;
implementation
{ TCefLazApplication }
procedure TCefLazApplication.Internal_OnContextInitialized;
begin
inherited Internal_OnContextInitialized;
Application.QueueAsyncCall(@CallContextInitializedHandlers, 0);
//TThread.Queue(@CallContextInitializedHandlers);
end;
procedure TCefLazApplication.CallContextInitializedHandlers(Data: PtrInt);
begin
FContextInitializedHandlers.CallNotifyEvents(Self);
FContextInitializedDone := True;
end;
constructor TCefLazApplication.Create;
begin
FContextInitializedHandlers := TMethodList.Create;
inherited Create;
end;
destructor TCefLazApplication.Destroy;
begin
inherited Destroy;
FContextInitializedHandlers.Free;
end;
procedure TCefLazApplication.AddContextInitializedHandler(AHandler: TNotifyEvent);
begin
FContextInitializedHandlers.Add(TMethod(AHandler));
if FContextInitializedDone then
AHandler(Self);
end;
procedure TCefLazApplication.RemoveContextInitializedHandler(
AHandler: TNotifyEvent);
begin
FContextInitializedHandlers.Remove(TMethod(AHandler));
end;
end.

View File

@ -44,7 +44,7 @@
*)
unit uCEFLazarusOsrBrowserWindow;
unit uCEFOsrBrowserWindow;
{$mode objfpc}{$H+}
{$i cef.inc}
@ -52,15 +52,17 @@ unit uCEFLazarusOsrBrowserWindow;
interface
uses
{$IFDEF DARWIN} // $IFDEF MACOSX
uCEFLazarusCocoa,
{$ENDIF}
{$IFDEF FPC}
LResources, PropEdits,
{$ENDIF}
uCEFApplication, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces, uCEFChromium,
uCEFLinkedWinControlBase, uCEFLazApplication, uCEFBufferPanel,
uCEFLazarusBrowserWindow, uCEFBitmapBitBuffer, uCEFMiscFunctions,
uCEFLinkedWinControlBase, uCEFBufferPanel,
uCEFBrowserWindow, uCEFBitmapBitBuffer, uCEFMiscFunctions,
uCEFConstants, uCEFChromiumEvents, Forms, ExtCtrls, LCLType, Graphics,
Controls, syncobjs, LazLogger, Classes, sysutils, math;
Controls, syncobjs, Classes, sysutils, math;
type
@ -77,13 +79,31 @@ type
//TBrowserKeyPressEvent = procedure(Sender: TObject; var Key: char; var AHandled: Boolean) of Object;
TBrowserUTF8KeyPressEvent = procedure(Sender: TObject; var UTF8Key: TUTF8Char; var AHandled: Boolean) of Object;
(* TEmbeddedOsrChromium
TLazOsrChromium = class(TLazChromium)
Hides (THiddenPropertyEditor) any published event that is used by TOsrBrowserWindow
* Hidden events must also not be used by user code *
*)
TEmbeddedOsrChromium = class(TEmbeddedChromium)
end;
{ TLazarusOsrBrowserWindow }
{ TOsrBrowserWindow - Off-Screen-Rendering
TLazarusOsrBrowserWindow = class(TBufferPanel)
A simple "drop on the Form" component for an full embedded browser.
See notes an TBrowserWindow for requirements in user code.
Further:
- Some keystrokes may not be sent to KeyDown/KeyPress by the LCL.
They may be available as WM_SYSKEYDOWN/UP message on the containing Form.
This component is still experimental.
- On MacOS Keyboard support is not complete
}
TOsrBrowserWindow = class(TBufferPanel)
private
FPopUpBitmap : TBitmap;
FPopUpRect : TRect;
@ -136,7 +156,7 @@ type
AHeight: Integer);
private
FChromium : TLazOsrChromium;
FChromium : TEmbeddedOsrChromium;
FOnBrowserClosed : TNotifyEvent;
FOnBrowserCreated : TNotifyEvent;
@ -151,7 +171,7 @@ type
procedure DoCreateBrowserAfterContext(Sender: TObject);
protected
function GetChromium: TLazOsrChromium;
function GetChromium: TEmbeddedOsrChromium;
function getModifiers(Shift: TShiftState): TCefEventFlags;
function getKeyModifiers(Shift: TShiftState): TCefEventFlags;
function GetButton(Button: TMouseButton): TCefMouseButtonType;
@ -193,11 +213,16 @@ type
procedure LoadURL(aURL: ustring);
//
published
property Chromium : TLazOsrChromium read GetChromium;
property Chromium : TEmbeddedOsrChromium read GetChromium;
property OnBrowserCreated : TNotifyEvent read FOnBrowserCreated write FOnBrowserCreated;
property OnBrowserClosed : TNotifyEvent read FOnBrowserClosed write FOnBrowserClosed;
(* Mouse/Key events
The below events can be used to see mouse/key input before it is sent to CEF.
All events have a "AHandled" parameter, which can be used to prevent the event
from being sent to CEF.
*)
property OnMouseDown: TBrowserMouseEvent read FOnMouseDown write FOnMouseDown;
property OnMouseUp: TBrowserMouseEvent read FOnMouseUp write FOnMouseUp;
property OnMouseMove: TBrowserMouseMoveEvent read FOnMouseMove write FOnMouseMove;
@ -214,14 +239,14 @@ procedure Register;
implementation
{ TLazarusOsrBrowserWindow }
{ TOsrBrowserWindow }
procedure TLazarusOsrBrowserWindow.AsyncInvalidate(Data: PtrInt);
procedure TOsrBrowserWindow.AsyncInvalidate(Data: PtrInt);
begin
Invalidate;
end;
procedure TLazarusOsrBrowserWindow.AsyncResize(Data: PtrInt);
procedure TOsrBrowserWindow.AsyncResize(Data: PtrInt);
begin
try
FResizeCS.Acquire;
@ -241,12 +266,12 @@ begin
end;
end;
procedure TLazarusOsrBrowserWindow.SyncIMERangeChanged;
procedure TOsrBrowserWindow.SyncIMERangeChanged;
begin
ChangeCompositionRange(FSelectedRange, FDeviceBounds);
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumBeforePopup(Sender: TObject;
procedure TOsrBrowserWindow.DoGetChromiumBeforePopup(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
@ -258,7 +283,7 @@ begin
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumPopupShow(Sender: TObject;
procedure TOsrBrowserWindow.DoGetChromiumPopupShow(Sender: TObject;
const browser: ICefBrowser; AShow: Boolean);
begin
if aShow then
@ -272,7 +297,7 @@ begin
end;
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumPopupSize(Sender: TObject;
procedure TOsrBrowserWindow.DoGetChromiumPopupSize(Sender: TObject;
const browser: ICefBrowser; const rect: PCefRect);
begin
LogicalToDevice(rect^, ScreenScale);
@ -283,7 +308,7 @@ begin
FPopUpRect.Bottom := rect^.y + rect^.height - 1;
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumTooltip(Sender: TObject;
procedure TOsrBrowserWindow.DoGetChromiumTooltip(Sender: TObject;
const browser: ICefBrowser; var AText: ustring; out Result: Boolean);
begin
hint := aText;
@ -291,7 +316,7 @@ begin
Result := True;
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumIMECompositionRangeChanged(
procedure TOsrBrowserWindow.DoGetChromiumIMECompositionRangeChanged(
Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange;
character_boundsCount: NativeUInt; const character_bounds: PCefRect);
var
@ -334,7 +359,7 @@ begin
TThread.Synchronize(nil, @SyncIMERangeChanged);
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumCursorChange(Sender: TObject;
procedure TOsrBrowserWindow.DoGetChromiumCursorChange(Sender: TObject;
const browser: ICefBrowser; cursor_: TCefCursorHandle;
cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo;
var aResult: boolean);
@ -343,7 +368,7 @@ begin
aResult := True;
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumGetScreenInfo(Sender: TObject;
procedure TOsrBrowserWindow.DoGetChromiumGetScreenInfo(Sender: TObject;
const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out
Result: Boolean);
var
@ -366,7 +391,7 @@ begin
Result := True;
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumGetScreenPoint(Sender: TObject;
procedure TOsrBrowserWindow.DoGetChromiumGetScreenPoint(Sender: TObject;
const browser: ICefBrowser; viewX, viewY: Integer; var screenX,
screenY: Integer; out Result: Boolean);
var
@ -382,7 +407,7 @@ begin
Result := True;
end;
procedure TLazarusOsrBrowserWindow.DoGetChromiumViewRect(Sender: TObject;
procedure TOsrBrowserWindow.DoGetChromiumViewRect(Sender: TObject;
const browser: ICefBrowser; var rect: TCefRect);
var
TempScale : single;
@ -394,7 +419,7 @@ begin
rect.height := DeviceToLogical(Height, TempScale);
end;
procedure TLazarusOsrBrowserWindow.DoChromiumPaint(Sender: TObject;
procedure TOsrBrowserWindow.DoChromiumPaint(Sender: TObject;
const browser: ICefBrowser; kind: TCefPaintElementType;
dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray;
const ABuffer: Pointer; AWidth, AHeight: Integer);
@ -530,12 +555,12 @@ begin
end;
end;
function TLazarusOsrBrowserWindow.GetChromium: TLazOsrChromium;
function TOsrBrowserWindow.GetChromium: TEmbeddedOsrChromium;
begin
Result := FChromium;
end;
function TLazarusOsrBrowserWindow.getModifiers(Shift: TShiftState
function TOsrBrowserWindow.getModifiers(Shift: TShiftState
): TCefEventFlags;
begin
Result := EVENTFLAG_NONE;
@ -549,7 +574,7 @@ begin
if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
end;
function TLazarusOsrBrowserWindow.getKeyModifiers(Shift: TShiftState): TCefEventFlags;
function TOsrBrowserWindow.getKeyModifiers(Shift: TShiftState): TCefEventFlags;
begin
Result := EVENTFLAG_NONE;
@ -561,7 +586,7 @@ begin
if (ssCaps in Shift) then Result := Result or EVENTFLAG_CAPS_LOCK_ON;
end;
function TLazarusOsrBrowserWindow.GetButton(Button: TMouseButton
function TOsrBrowserWindow.GetButton(Button: TMouseButton
): TCefMouseButtonType;
begin
case Button of
@ -571,23 +596,20 @@ begin
end;
end;
procedure TLazarusOsrBrowserWindow.DoCreateBrowserAfterContext(Sender: TObject);
procedure TOsrBrowserWindow.DoCreateBrowserAfterContext(Sender: TObject);
begin
FChromium.CreateBrowser(nil);
end;
procedure TLazarusOsrBrowserWindow.CreateHandle;
procedure TOsrBrowserWindow.CreateHandle;
begin
inherited CreateHandle;
if not (csDesigning in ComponentState) then begin
if GlobalCEFApp is TCefLazApplication then
TCefLazApplication(GlobalCEFApp).AddContextInitializedHandler(@DoCreateBrowserAfterContext)
else
DoCreateBrowserAfterContext(nil);
GlobalCEFApp.AddContextInitializedHandler(@DoCreateBrowserAfterContext);
end;
end;
procedure TLazarusOsrBrowserWindow.DestroyHandle;
procedure TOsrBrowserWindow.DestroyHandle;
begin
if (GlobalCEFApp = nil) or
(not FChromium.HasBrowser) or
@ -601,32 +623,32 @@ begin
inherited DestroyHandle;
end;
procedure TLazarusOsrBrowserWindow.RealizeBounds;
procedure TOsrBrowserWindow.RealizeBounds;
begin
inherited RealizeBounds;
Chromium.NotifyMoveOrResizeStarted;
AsyncResize(0);
end;
procedure TLazarusOsrBrowserWindow.DoEnter;
procedure TOsrBrowserWindow.DoEnter;
begin
inherited DoEnter;
Chromium.SendFocusEvent(True);
end;
procedure TLazarusOsrBrowserWindow.DoExit;
procedure TOsrBrowserWindow.DoExit;
begin
inherited DoExit;
Chromium.SendFocusEvent(False);
end;
procedure TLazarusOsrBrowserWindow.Click;
procedure TOsrBrowserWindow.Click;
begin
inherited Click;
SetFocus;
end;
procedure TLazarusOsrBrowserWindow.MouseDown(Button: TMouseButton;
procedure TOsrBrowserWindow.MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
TempEvent : TCefMouseEvent;
@ -654,7 +676,7 @@ begin
Chromium.SendMouseClickEvent(@TempEvent, GetButton(Button), False, LastClickCount);
end;
procedure TLazarusOsrBrowserWindow.MouseUp(Button: TMouseButton;
procedure TOsrBrowserWindow.MouseUp(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
TempEvent : TCefMouseEvent;
@ -680,7 +702,7 @@ begin
Chromium.SendMouseClickEvent(@TempEvent, GetButton(Button), True, LastClickCount);
end;
procedure TLazarusOsrBrowserWindow.MouseMove(Shift: TShiftState; X, Y: Integer);
procedure TOsrBrowserWindow.MouseMove(Shift: TShiftState; X, Y: Integer);
var
TempEvent : TCefMouseEvent;
IsHandled: Boolean;
@ -699,7 +721,7 @@ begin
Chromium.SendMouseMoveEvent(@TempEvent, False);
end;
procedure TLazarusOsrBrowserWindow.MouseEnter;
procedure TOsrBrowserWindow.MouseEnter;
var
TempEvent : TCefMouseEvent;
TempPoint : TPoint;
@ -714,7 +736,7 @@ begin
Chromium.SendMouseMoveEvent(@TempEvent, False);
end;
procedure TLazarusOsrBrowserWindow.MouseLeave;
procedure TOsrBrowserWindow.MouseLeave;
var
TempEvent : TCefMouseEvent;
TempPoint : TPoint;
@ -735,7 +757,7 @@ begin
Chromium.SendMouseMoveEvent(@TempEvent, True);
end;
function TLazarusOsrBrowserWindow.DoMouseWheel(Shift: TShiftState;
function TOsrBrowserWindow.DoMouseWheel(Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint): Boolean;
var
TempEvent : TCefMouseEvent;
@ -760,7 +782,7 @@ begin
Chromium.SendMouseWheelEvent(@TempEvent, 0, WheelDelta);
end;
procedure TLazarusOsrBrowserWindow.KeyDown(var Key: Word; Shift: TShiftState);
procedure TOsrBrowserWindow.KeyDown(var Key: Word; Shift: TShiftState);
var
TempKeyEvent : TCefKeyEvent;
IsHandled: Boolean;
@ -797,7 +819,7 @@ begin
inherited KeyDown(Key, Shift);
end;
procedure TLazarusOsrBrowserWindow.UTF8KeyPress(var UTF8Key: TUTF8Char);
procedure TOsrBrowserWindow.UTF8KeyPress(var UTF8Key: TUTF8Char);
var
TempKeyEvent : TCefKeyEvent;
TempString : UnicodeString;
@ -838,7 +860,7 @@ begin
inherited UTF8KeyPress(UTF8Key);
end;
procedure TLazarusOsrBrowserWindow.KeyUp(var Key: Word; Shift: TShiftState);
procedure TOsrBrowserWindow.KeyUp(var Key: Word; Shift: TShiftState);
var
TempKeyEvent : TCefKeyEvent;
IsHandled: Boolean;
@ -869,20 +891,20 @@ begin
end;
{$IFDEF MSWINDOWS}
procedure TLazarusOsrBrowserWindow.DoOnIMECancelComposition;
procedure TOsrBrowserWindow.DoOnIMECancelComposition;
begin
inherited DoOnIMECancelComposition;
Chromium.IMECancelComposition;
end;
procedure TLazarusOsrBrowserWindow.DoOnIMECommitText(const aText: ustring;
procedure TOsrBrowserWindow.DoOnIMECommitText(const aText: ustring;
const replacement_range: PCefRange; relative_cursor_pos: integer);
begin
inherited DoOnIMECommitText(aText, replacement_range, relative_cursor_pos);
Chromium.IMECommitText(aText, replacement_range, relative_cursor_pos);;
end;
procedure TLazarusOsrBrowserWindow.DoOnIMESetComposition(const aText: ustring;
procedure TOsrBrowserWindow.DoOnIMESetComposition(const aText: ustring;
const underlines: TCefCompositionUnderlineDynArray; const replacement_range,
selection_range: TCefRange);
begin
@ -891,20 +913,20 @@ begin
end;
{$ENDIF}
procedure TLazarusOsrBrowserWindow.CaptureChanged;
procedure TOsrBrowserWindow.CaptureChanged;
begin
inherited CaptureChanged;
if (Chromium <> nil) then Chromium.SendCaptureLostEvent;
end;
procedure TLazarusOsrBrowserWindow.DoOnCreated(Sender: TObject);
procedure TOsrBrowserWindow.DoOnCreated(Sender: TObject);
begin
if Assigned(FOnBrowserCreated) then
FOnBrowserCreated(Self);
end;
procedure TLazarusOsrBrowserWindow.DoOnClosed(Sender: TObject);
procedure TOsrBrowserWindow.DoOnClosed(Sender: TObject);
begin
if (not(csDestroying in ComponentState)) and
Assigned(FOnBrowserClosed)
@ -912,7 +934,7 @@ begin
FOnBrowserClosed(Self);
end;
constructor TLazarusOsrBrowserWindow.Create(AOwner: TComponent);
constructor TOsrBrowserWindow.Create(AOwner: TComponent);
begin
FResizeCS := TCriticalSection.Create;
@ -920,7 +942,7 @@ begin
FSelectedRange.from := 0;
FSelectedRange.to_ := 0;
FChromium := TLazOsrChromium.Create(Self);
FChromium := TEmbeddedOsrChromium.Create(Self);
FChromium.InternalOnBrowserClosed := {$IFDEF FPC}@{$ENDIF}DoOnClosed;
FChromium.InternalOnBrowserCreated := {$IFDEF FPC}@{$ENDIF}DoOnCreated;
@ -936,10 +958,11 @@ begin
FChromium.OnIMECompositionRangeChanged := @DoGetChromiumIMECompositionRangeChanged;
inherited Create(AOwner);
ControlStyle := ControlStyle + [csOwnedChildrenNotSelectable];
CopyOriginalBuffer := true;
end;
destructor TLazarusOsrBrowserWindow.Destroy;
destructor TOsrBrowserWindow.Destroy;
begin
inherited Destroy;
FreeAndNil(FResizeCS);
@ -950,12 +973,12 @@ begin
end;
end;
procedure TLazarusOsrBrowserWindow.CloseBrowser(aForceClose: boolean);
procedure TOsrBrowserWindow.CloseBrowser(aForceClose: boolean);
begin
FChromium.CloseBrowser(aForceClose);
end;
procedure TLazarusOsrBrowserWindow.WaitForBrowserClosed;
procedure TOsrBrowserWindow.WaitForBrowserClosed;
begin
if not FChromium.HasBrowser then
exit;
@ -971,12 +994,12 @@ begin
// TODO : sent closed?
end;
function TLazarusOsrBrowserWindow.IsClosed: boolean;
function TOsrBrowserWindow.IsClosed: boolean;
begin
Result := not FChromium.HasBrowser;
end;
procedure TLazarusOsrBrowserWindow.LoadURL(aURL: ustring);
procedure TOsrBrowserWindow.LoadURL(aURL: ustring);
begin
FChromium.LoadURL(aURL);
end;
@ -985,19 +1008,20 @@ end;
{$IFDEF FPC}
procedure Register;
begin
// {$I res/tlazarusosrbrowserwindow.lrs}
RegisterComponents('Chromium', [TLazarusOsrBrowserWindow]);
RegisterPropertyEditor(TypeInfo(TOnClose), TLazOsrChromium,'OnClose',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnPaint), TLazOsrChromium,'OnPaint',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnGetViewRect), TLazOsrChromium,'OnGetViewRect',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnCursorChange), TLazOsrChromium,'OnCursorChange',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnGetScreenPoint), TLazOsrChromium,'OnGetScreenPoint',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnGetScreenInfo), TLazOsrChromium,'OnGetScreenInfo',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnPopupShow), TLazOsrChromium,'OnPopupShow',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnPopupSize), TLazOsrChromium,'OnPopupSize',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnTooltip), TLazOsrChromium,'OnTooltip',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnBeforePopup), TLazOsrChromium,'OnBeforePopup',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnIMECompositionRangeChanged), TLazOsrChromium,'OnIMECompositionRangeChanged',THiddenPropertyEditor);
{$I res/TOsrBrowserWindow.lrs}
RegisterComponents('Chromium', [TOsrBrowserWindow]);
RegisterClass(TEmbeddedOsrChromium);
RegisterPropertyEditor(TypeInfo(TOnClose), TEmbeddedOsrChromium,'OnClose',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnPaint), TEmbeddedOsrChromium,'OnPaint',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnGetViewRect), TEmbeddedOsrChromium,'OnGetViewRect',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnCursorChange), TEmbeddedOsrChromium,'OnCursorChange',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnGetScreenPoint), TEmbeddedOsrChromium,'OnGetScreenPoint',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnGetScreenInfo), TEmbeddedOsrChromium,'OnGetScreenInfo',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnPopupShow), TEmbeddedOsrChromium,'OnPopupShow',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnPopupSize), TEmbeddedOsrChromium,'OnPopupSize',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnTooltip), TEmbeddedOsrChromium,'OnTooltip',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnBeforePopup), TEmbeddedOsrChromium,'OnBeforePopup',THiddenPropertyEditor);
RegisterPropertyEditor(TypeInfo(TOnIMECompositionRangeChanged), TEmbeddedOsrChromium,'OnIMECompositionRangeChanged',THiddenPropertyEditor);
end;
{$ENDIF}