From 9f397c67f838081ba78ea118006d37413f27d5ec Mon Sep 17 00:00:00 2001 From: Mobius One Date: Mon, 11 Nov 2024 20:34:16 -0300 Subject: [PATCH 1/2] =?UTF-8?q?-=20Atualiza=C3=A7=C3=A3o=20de=20TBG=20pra?= =?UTF-8?q?=20vers=C3=A3o=20130=20do=20CEF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Browser/Browser.Chromium.Events.pas | 275 +++++++++++---------- Source/Browser/Browser.FMX.Chromium.pas | 191 +++++++------- Source/Include/TBGWebCharts.inc | 13 +- TBGWebCharts.dproj | 178 +++++++++++-- 4 files changed, 405 insertions(+), 252 deletions(-) diff --git a/Source/Browser/Browser.Chromium.Events.pas b/Source/Browser/Browser.Chromium.Events.pas index f9cbf3c..57fe343 100644 --- a/Source/Browser/Browser.Chromium.Events.pas +++ b/Source/Browser/Browser.Chromium.Events.pas @@ -1,70 +1,84 @@ -unit Browser.Chromium.Events; - -{$I TBGWebCharts.inc} - -interface - -uses - Interfaces, - uCEFInterfaces, - uCEFTypes, - Generics.Collections, - System.SysUtils; - -const +unit Browser.Chromium.Events; + +{$I TBGWebCharts.inc} + +interface + +uses + Interfaces, + uCEFInterfaces, + uCEFTypes, + Generics.Collections, + System.SysUtils; + +const CONSOLE_MSG_PREAMBLE = 'DOMVISITOR'; - WEBCHART_PREAMBLE = 'TBGWebCharts_'; - -type - TChromiumEvents = class - private - FChromiumResources : iModelChromiumResources; - public - constructor Create; - destructor Destroy; override; - procedure Chromium_ConsoleMessage(Sender: TObject; const browser: ICefBrowser; level: Cardinal; const message, source: ustring; line: Integer; out Result: Boolean); -// {$IF RTLVERSION > 22 } - procedure Chromium_BeforeBrowse(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; user_gesture, isRedirect: Boolean; out Result: Boolean); -// {$ENDIF} - procedure Chromium_OnBeforePopup(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 Chromium_OnGetResourceHandler(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; var aResourceHandler : ICefResourceHandler); - function Resources : iModelChromiumResources; - - end; - -var - vChromiumEvents : TChromiumEvents; - -implementation - -uses -// {$IF RTLVERSION > 22 } - CallBackJS, -// {$ENDIF} - Browser.Chromium.Resources, - System.Classes; - -{ TVCLChromiumEvents } - -//{$IF RTLVERSION > 22 } -procedure TChromiumEvents.Chromium_BeforeBrowse(Sender: TObject; - const browser: ICefBrowser; const frame: ICefFrame; - const request: ICefRequest; user_gesture, isRedirect: Boolean; - out Result: Boolean); -var - Target : String; + + WEBCHART_PREAMBLE = 'TBGWebCharts_'; + +type + TChromiumEvents = class + private + FChromiumResources: iModelChromiumResources; + public + constructor Create; + destructor Destroy; override; + procedure Chromium_ConsoleMessage(Sender: TObject; const Browser: ICefBrowser; + level: TCefLogSeverity; const message, source: ustring; line: Integer; + out Result: Boolean); + // {$IF RTLVERSION > 22 } + procedure Chromium_BeforeBrowse(Sender: TObject; const Browser: ICefBrowser; + const frame: ICefFrame; const request: ICefRequest; + user_gesture, isRedirect: Boolean; out Result: Boolean); + // {$ENDIF} + procedure Chromium_OnBeforePopup(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 Chromium_OnGetResourceHandler(Sender: TObject; const Browser: ICefBrowser; + const frame: ICefFrame; const request: ICefRequest; + var aResourceHandler: ICefResourceHandler); + + function Resources: iModelChromiumResources; + + end; + +var + vChromiumEvents: TChromiumEvents; + +implementation + +uses + // {$IF RTLVERSION > 22 } + CallBackJS, + // {$ENDIF} + Browser.Chromium.Resources, + System.Classes; + +{ TVCLChromiumEvents } + +// {$IF RTLVERSION > 22 } +procedure TChromiumEvents.Chromium_BeforeBrowse(Sender: TObject; + const Browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; + user_gesture, isRedirect: Boolean; out Result: Boolean); +var + Target: String; Aux, Method: string; - Params : TStringList; -begin - Target := request.Url; - if UpperCase(Target).StartsWith('ACTIONCALLBACKJS') then + Params: TStringList; +begin + Target := request.Url; + if UpperCase(Target).StartsWith('ACTIONCALLBACKJS') then begin - Method := Copy(Target, Pos(':', Target) + 1, Length(Target)); + Method := Copy(Target, Pos(':', Target) + 1, Length(Target)); Method := Copy(Method, 1, Pos('(', Method) - 1); Params := TStringList.Create; try Aux := Copy(Target, Pos('(', Target) + 1, Length(Target)); - Aux := Copy(Aux, 1, LastDelimiter(')', Aux)-1); + Aux := Copy(Aux, 1, LastDelimiter(')', Aux) - 1); Params.CommaText := Aux; if not Method.IsEmpty then if vCallBackJS.TryGetValue(Method, Params) then @@ -74,76 +88,79 @@ procedure TChromiumEvents.Chromium_BeforeBrowse(Sender: TObject; end; end; end; -//{$ENDIF} - -procedure TChromiumEvents.Chromium_ConsoleMessage(Sender: TObject; - const browser: ICefBrowser; level: Cardinal; const message, source: ustring; - line: Integer; out Result: Boolean); -var - Key : string; - position : integer; - FMessage : string; - Proc : TProc; -begin - if (length(message) > 0) and - (copy(message, 1, length(CONSOLE_MSG_PREAMBLE)) = CONSOLE_MSG_PREAMBLE) then - begin - position := Pos('|', message) + 1; - Key := Copy(message, Succ(Length(CONSOLE_MSG_PREAMBLE)), position -2 - Length(CONSOLE_MSG_PREAMBLE)); - Fmessage := Copy(message, position, Length(message)); - Proc := FChromiumResources.JSCallback.Extract(key); - if Assigned (Proc) then - Proc(FMessage); - end; -end; - -procedure TChromiumEvents.Chromium_OnBeforePopup(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, Result: Boolean); -begin - Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); -end; - -procedure TChromiumEvents.Chromium_OnGetResourceHandler(Sender: TObject; - const browser: ICefBrowser; const frame: ICefFrame; - const request: ICefRequest; var aResourceHandler: ICefResourceHandler); -var - Key: String; - position : integer; -begin - if UpperCase(request.Url).StartsWith('HTTP://TBGWEBCHARTS_') then - begin - position := Pos('_', request.Url) + 1; - Key := Copy(request.Url, position, Length(request.Url) - position); - aResourceHandler := FChromiumResources.Pages.extract(Key); - end; -end; - -constructor TChromiumEvents.Create; -begin - FChromiumResources := TChromiumResources.New; -end; - -destructor TChromiumEvents.Destroy; -begin - - inherited; -end; - -function TChromiumEvents.Resources: iModelChromiumResources; -begin - Result := FChromiumResources; -end; - -initialization - vChromiumEvents := TChromiumEvents.Create; +// {$ENDIF} + +procedure TChromiumEvents.Chromium_ConsoleMessage(Sender: TObject; + const Browser: ICefBrowser; level: TCefLogSeverity; const message, source: ustring; + line: Integer; out Result: Boolean); +var + Key: string; + position: Integer; + FMessage: string; + Proc: TProc; +begin + if (Length(message) > 0) and (Copy(message, 1, Length(CONSOLE_MSG_PREAMBLE)) + = CONSOLE_MSG_PREAMBLE) then + begin + position := Pos('|', message) + 1; + Key := Copy(message, Succ(Length(CONSOLE_MSG_PREAMBLE)), + position - 2 - Length(CONSOLE_MSG_PREAMBLE)); + FMessage := Copy(message, position, Length(message)); + Proc := FChromiumResources.JSCallback.Extract(Key); + if Assigned(Proc) then + Proc(FMessage); + end; +end; + +procedure TChromiumEvents.Chromium_OnBeforePopup(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, Result: Boolean); +begin + Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, + CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]); +end; + +procedure TChromiumEvents.Chromium_OnGetResourceHandler(Sender: TObject; + const Browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; + var aResourceHandler: ICefResourceHandler); +var + Key: String; + position: Integer; +begin + if UpperCase(request.Url).StartsWith('HTTP://TBGWEBCHARTS_') then + begin + position := Pos('_', request.Url) + 1; + Key := Copy(request.Url, position, Length(request.Url) - position); + aResourceHandler := FChromiumResources.Pages.Extract(Key); + end; +end; + +constructor TChromiumEvents.Create; +begin + FChromiumResources := TChromiumResources.New; +end; + +destructor TChromiumEvents.Destroy; +begin + + inherited; +end; + +function TChromiumEvents.Resources: iModelChromiumResources; +begin + Result := FChromiumResources; +end; + +initialization + +vChromiumEvents := TChromiumEvents.Create; finalization - FreeAndNil(vChromiumEvents); + +FreeAndNil(vChromiumEvents); end. - diff --git a/Source/Browser/Browser.FMX.Chromium.pas b/Source/Browser/Browser.FMX.Chromium.pas index e604c10..9146660 100644 --- a/Source/Browser/Browser.FMX.Chromium.pas +++ b/Source/Browser/Browser.FMX.Chromium.pas @@ -1,113 +1,114 @@ -unit Browser.FMX.Chromium; - -{$I TBGWebCharts.inc} - -interface - -uses - Interfaces, - uCEFFMXChromium, - uCEFFMXWindowParent; - -type - TModelBrowserFMXChromium = class(TInterfacedObject, iModelBrowser) +unit Browser.FMX.Chromium; + +{$I TBGWebCharts.inc} + +interface + +uses + Interfaces, + uCEFFMXChromium, + uCEFFMXWindowParent; + +type + TModelBrowserFMXChromium = class(TInterfacedObject, iModelBrowser) private FChromium : TFMXChromium; FWindowParent : TFMXWindowParent; - public + public constructor Create(Chromium : TFMXChromium; WindowParent : TFMXWindowParent); destructor Destroy; override; class function New(Chromium : TFMXChromium; WindowParent : TFMXWindowParent) : iModelBrowser; procedure ExecuteScript(Value : iModelJSCommand); function ExecuteScriptResult(Value : iModelJSCommand) : string; - procedure ExecuteScriptCallback(Value: iModelJSCommand); - function Generated(FHTML : string) : iModelBrowser; - end; - -implementation -uses -// {$IF RTLVERSION > 22 } - CallBackJS, -// {$ENDIF} - Browser.Chromium.Events, System.SysUtils, FMX.Forms, Winapi.Windows, - System.Types, FMX.Platform.Win; - -{ TModelBrowserFMXChromium } - -constructor TModelBrowserFMXChromium.Create(Chromium: TFMXChromium; - WindowParent: TFMXWindowParent); -begin - FChromium := Chromium; - FWindowParent := WindowParent; - - FChromium.OnBeforePopup := vChromiumEvents.Chromium_OnBeforePopup; - FChromium.OnGetResourceHandler := vChromiumEvents.Chromium_OnGetResourceHandler; -// {$IF RTLVERSION > 22 } - FChromium.OnBeforeBrowse := vChromiumEvents.Chromium_BeforeBrowse; -// {$ENDIF} - FChromium.OnConsoleMessage := vChromiumEvents.Chromium_ConsoleMessage; -end; - -destructor TModelBrowserFMXChromium.Destroy; -begin - - inherited; -end; - -procedure TModelBrowserFMXChromium.ExecuteScript(Value: iModelJSCommand); -begin - FChromium.ExecuteJavaScript(value.ResultCommand , 'about:blank', 0); -end; - -procedure TModelBrowserFMXChromium.ExecuteScriptCallback( - Value: iModelJSCommand); -var - key : String; -begin - if not Assigned(Value.CallBack) then - raise Exception.Create('Procedure para Callback inválida'); - key := vChromiumEvents.Resources.JSCallback.Add(Value.Callback); - FChromium.ExecuteJavaScript( + procedure ExecuteScriptCallback(Value: iModelJSCommand); + function Generated(FHTML : string) : iModelBrowser; + end; + +implementation +uses +// {$IF RTLVERSION > 22 } + CallBackJS, +// {$ENDIF} + Browser.Chromium.Events, System.SysUtils, FMX.Forms, Winapi.Windows, + System.Types, FMX.Platform.Win; + +{ TModelBrowserFMXChromium } + +constructor TModelBrowserFMXChromium.Create(Chromium: TFMXChromium; + WindowParent: TFMXWindowParent); +begin + FChromium := Chromium; + FWindowParent := WindowParent; + + FChromium.OnBeforePopup := vChromiumEvents.Chromium_OnBeforePopup; + FChromium.OnGetResourceHandler := vChromiumEvents.Chromium_OnGetResourceHandler; +// {$IF RTLVERSION > 22 } + FChromium.OnBeforeBrowse := vChromiumEvents.Chromium_BeforeBrowse; +// {$ENDIF} + FChromium.OnConsoleMessage := vChromiumEvents.Chromium_ConsoleMessage; +end; + +destructor TModelBrowserFMXChromium.Destroy; +begin + + inherited; +end; + +procedure TModelBrowserFMXChromium.ExecuteScript(Value: iModelJSCommand); +begin + FChromium.ExecuteJavaScript(value.ResultCommand , 'about:blank', ''); +end; + +procedure TModelBrowserFMXChromium.ExecuteScriptCallback( + Value: iModelJSCommand); +var + key : String; +begin + if not Assigned(Value.CallBack) then + raise Exception.Create('Procedure para Callback inválida'); + key := vChromiumEvents.Resources.JSCallback.Add(Value.Callback); + FChromium.ExecuteJavaScript( Value.ResultCommand + ';' + 'console.log(''' + CONSOLE_MSG_PREAMBLE + Key + '|'' + document.getElementById(''' + Value.TagID + ''').' + Value.TagAttribute + ');' - ,'about:blank', 0); -end; - -function TModelBrowserFMXChromium.ExecuteScriptResult( - Value: iModelJSCommand): string; -begin - Result := 'Use ExecuteScriptCallback'; -end; - -function TModelBrowserFMXChromium.Generated(FHTML: string): iModelBrowser; -var - Key : string; - TempHandle : HWND; + ,'about:blank', ''); +end; + +function TModelBrowserFMXChromium.ExecuteScriptResult( + Value: iModelJSCommand): string; +begin + Result := 'Use ExecuteScriptCallback'; +end; + +function TModelBrowserFMXChromium.Generated(FHTML: string): iModelBrowser; +var + Key : string; + TempHandle : HWND; TempRect : System.Types.TRect; TempClientRect : TRectF; - begin - Result := Self; - Key := vChromiumEvents.Resources.Pages.add(FHTML); - - TempHandle := FmxHandleToHWND(FWindowParent.Handle); + +begin + Result := Self; + Key := vChromiumEvents.Resources.Pages.add(FHTML); + + TempHandle := FmxHandleToHWND(FWindowParent.Handle); TempClientRect := FWindowParent.ClientRect; TempRect.Left := round(TempClientRect.Left); TempRect.Top := round(TempClientRect.Top); TempRect.Right := round(TempClientRect.Right); TempRect.Bottom := round(TempClientRect.Bottom); - - FChromium.CreateBrowser(TempHandle, TempRect); - - while not FChromium.Initialized do - Application.ProcessMessages; - FChromium.loadURL(WEBCHART_PREAMBLE + Key); -end; - -class function TModelBrowserFMXChromium.New(Chromium: TFMXChromium; - WindowParent: TFMXWindowParent): iModelBrowser; -begin - Result := Self.Create(Chromium, WindowParent); -end; - -end. + + FChromium.CreateBrowser(TempHandle, TempRect); + + while not FChromium.Initialized do + Application.ProcessMessages; + FChromium.loadURL(WEBCHART_PREAMBLE + Key); +end; + +class function TModelBrowserFMXChromium.New(Chromium: TFMXChromium; + WindowParent: TFMXWindowParent): iModelBrowser; +begin + Result := Self.Create(Chromium, WindowParent); +end; + +end. diff --git a/Source/Include/TBGWebCharts.inc b/Source/Include/TBGWebCharts.inc index e317b11..ba212d5 100644 --- a/Source/Include/TBGWebCharts.inc +++ b/Source/Include/TBGWebCharts.inc @@ -1,4 +1,11 @@ -{$DEFINE FULL} +{$DEFINE FULL} -//{$DEFINE HAS_FMX} -//{$DEFINE HAS_CHROMIUM} \ No newline at end of file +{$IFNDEF FPC} + {$IF Declared(FireMonkeyVersion) or Defined(FRAMEWORK_FMX) or Defined(LINUX64)} + {$DEFINE HAS_FMX} + {$IFEND} +{$ENDIF} + +(* IF CEF is installed, uncomment below*) + + {$DEFINE HAS_CHROMIUM} \ No newline at end of file diff --git a/TBGWebCharts.dproj b/TBGWebCharts.dproj index 3c16fa9..dec046b 100644 --- a/TBGWebCharts.dproj +++ b/TBGWebCharts.dproj @@ -4,11 +4,12 @@ TBGWebCharts.dpk True Debug - 1 + 1048577 Package VCL - 19.5 + 20.2 Win32 + TBGWebCharts true @@ -23,6 +24,11 @@ Base true + + true + Base + true + true Base @@ -67,6 +73,14 @@ vcl;rtl;vclie;fmx;dbrtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) + + System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + true + RELEASE;$(DCC_Define) 0 @@ -258,15 +272,11 @@ True False + True - + - - - TBGWebCharts.bpl - true - - + 1 @@ -275,16 +285,6 @@ 0 - - - classes - 64 - - - classes - 64 - - res\xml @@ -295,12 +295,6 @@ 1 - - - library\lib\armeabi-v7a - 1 - - library\lib\armeabi @@ -353,6 +347,16 @@ 1 + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + res\values @@ -373,6 +377,66 @@ 1 + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + res\values @@ -383,6 +447,16 @@ 1 + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + res\drawable @@ -553,6 +627,56 @@ 1 + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + 1 @@ -730,6 +854,9 @@ 1 + + 1 + @@ -991,6 +1118,7 @@ + 12 From d0021851626039a6bc6b91cb8ad070445db80e01 Mon Sep 17 00:00:00 2001 From: Mobius One Date: Mon, 11 Nov 2024 20:43:44 -0300 Subject: [PATCH 2/2] =?UTF-8?q?-=20Corre=C3=A7=C3=A3o=20pra=20VCL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Browser/Browser.VCL.Chromium.pas | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Source/Browser/Browser.VCL.Chromium.pas b/Source/Browser/Browser.VCL.Chromium.pas index d2d74bf..6d4ade5 100644 --- a/Source/Browser/Browser.VCL.Chromium.pas +++ b/Source/Browser/Browser.VCL.Chromium.pas @@ -5,23 +5,23 @@ interface uses - Interfaces, - uCEFChromium, - uCEFWindowParent, - uCEFInterfaces; - + Interfaces, + uCEFChromium, + uCEFWindowParent, + uCEFInterfaces; + Type TModelBrowserVCLChromium = class(TInterfacedObject, iModelBrowser) - private - FChromium : TChromium; - FWindowParent : TCEFWindowParent; - + private + FChromium : TChromium; + FWindowParent : TCEFWindowParent; + public - constructor Create(Chromium : TChromium; WindowParent : TCEFWindowParent); - destructor Destroy; override; - class function New(Chromium : TChromium; WindowParent : TCEFWindowParent) : iModelBrowser; - procedure ExecuteScript(Value : iModelJSCommand); - function ExecuteScriptResult(Value : iModelJSCommand) : string; + constructor Create(Chromium : TChromium; WindowParent : TCEFWindowParent); + destructor Destroy; override; + class function New(Chromium : TChromium; WindowParent : TCEFWindowParent) : iModelBrowser; + procedure ExecuteScript(Value : iModelJSCommand); + function ExecuteScriptResult(Value : iModelJSCommand) : string; procedure ExecuteScriptCallback(Value: iModelJSCommand); function Generated(FHTML : string) : iModelBrowser; end; @@ -59,7 +59,7 @@ destructor TModelBrowserVCLChromium.Destroy; procedure TModelBrowserVCLChromium.ExecuteScript(Value: iModelJSCommand); begin - FChromium.ExecuteJavaScript(value.ResultCommand , 'about:blank', 0); + FChromium.ExecuteJavaScript(value.ResultCommand , 'about:blank', ''); end; procedure TModelBrowserVCLChromium.ExecuteScriptCallback( @@ -71,16 +71,16 @@ procedure TModelBrowserVCLChromium.ExecuteScriptCallback( raise Exception.Create('Procedure para Callback inválida'); key := vChromiumEvents.Resources.JSCallback.Add(Value.Callback); FChromium.ExecuteJavaScript( - Value.ResultCommand + ';' + - 'console.log(''' + CONSOLE_MSG_PREAMBLE + Key + '|'' + document.getElementById(''' + Value.TagID + ''').' + Value.TagAttribute + ');' - ,'about:blank', 0); + Value.ResultCommand + ';' + + 'console.log(''' + CONSOLE_MSG_PREAMBLE + Key + '|'' + document.getElementById(''' + Value.TagID + ''').' + Value.TagAttribute + ');' + ,'about:blank', ''); end; function TModelBrowserVCLChromium.ExecuteScriptResult( Value: iModelJSCommand): string; begin Result := 'Use ExecuteScriptCallback'; -end; +end; function TModelBrowserVCLChromium.Generated(FHTML: string): iModelBrowser; var