Skip to content

Commit

Permalink
Update to WebView2 NuGet 1.0.1072.54
Browse files Browse the repository at this point in the history
  • Loading branch information
salvadordf committed Jan 11, 2022
1 parent 1747211 commit ac17ee5
Show file tree
Hide file tree
Showing 19 changed files with 731 additions and 204 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WebView4Delphi is an open source project created by Salvador Díaz Fau to embed

WebView4Delphi only supports Windows. If you need to embed a web browser in Linux, Windows or MacOS consider using [CEF4Delphi](https://github.com/salvadordf/CEF4Delphi) instead.

WebView4Delphi uses the [Microsoft Edge WebView2 Runtime](https://docs.microsoft.com/en-us/microsoft-edge/webview2/) and [Microsoft.Web.WebView2 NuGet package version 1.0.1054.31](https://www.nuget.org/packages/Microsoft.Web.WebView2) to embed a web browser.
WebView4Delphi uses the [Microsoft Edge WebView2 Runtime](https://docs.microsoft.com/en-us/microsoft-edge/webview2/) and [Microsoft.Web.WebView2 NuGet package version 1.0.1072.54](https://www.nuget.org/packages/Microsoft.Web.WebView2) to embed a web browser.

WebView4Delphi was developed and tested on Delphi 11.0, Delphi XE3 and Lazarus 2.2.0/FPC 3.2.2.

Expand Down
Binary file modified bin32/WebView2Loader.dll
Binary file not shown.
Binary file modified bin64/WebView2Loader.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ object MiniBrowserFrm: TMiniBrowserFrm
Caption = 'Change user agent string...'
OnClick = Changeuseragentstring1Click
end
object Muted1: TMenuItem
Caption = 'Muted'
OnClick = Muted1Click
end
end
object OpenDialog1: TOpenDialog
Left = 48
Expand Down
11 changes: 10 additions & 1 deletion demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ TMiniBrowserFrm = class(TForm)
Availablebrowserversion1: TMenuItem;
SaveToFileMi: TMenuItem;
Changeuseragentstring1: TMenuItem;
Muted1: TMenuItem;

procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
Expand Down Expand Up @@ -97,6 +98,7 @@ TMiniBrowserFrm = class(TForm)
procedure WVBrowser1RetrieveHTMLCompleted(Sender: TObject; aResult: Boolean; const aHTML: wvstring);
procedure WVBrowser1RetrieveTextCompleted(Sender: TObject; aResult: Boolean; const aText: wvstring);
procedure WVBrowser1RetrieveMHTMLCompleted(Sender: TObject; aResult: Boolean; const aMHTML: wvstring);
procedure Muted1Click(Sender: TObject);

protected
FDownloadOperation : TCoreWebView2DownloadOperation;
Expand Down Expand Up @@ -154,7 +156,7 @@ procedure TMiniBrowserFrm.akesnapshot1Click(Sender: TObject);

procedure TMiniBrowserFrm.Availablebrowserversion1Click(Sender: TObject);
begin
showmessage(GlobalWebView2Loader.AvailableBrowserVersion);
showmessage('Available browser version : ' + GlobalWebView2Loader.AvailableBrowserVersion);
end;

procedure TMiniBrowserFrm.BackBtnClick(Sender: TObject);
Expand Down Expand Up @@ -271,6 +273,11 @@ procedure TMiniBrowserFrm.LoadFromFileMiClick(Sender: TObject);
end;
end;

procedure TMiniBrowserFrm.Muted1Click(Sender: TObject);
begin
WVBrowser1.ToggleMuteState;
end;

procedure TMiniBrowserFrm.LoadFromFileAsString(const aFileName : string);
var
TempLines : TStringList;
Expand Down Expand Up @@ -325,6 +332,7 @@ procedure TMiniBrowserFrm.PopupMenu1Popup(Sender: TObject);
Blockimages1.Checked := FBlockImages;
Offline1.Checked := WVBrowser1.Offline;
Ignorecertificateerrors1.Checked := WVBrowser1.IgnoreCertificateErrors;
Muted1.Checked := WVBrowser1.IsMuted;
end;

procedure TMiniBrowserFrm.Print1Click(Sender: TObject);
Expand Down Expand Up @@ -648,6 +656,7 @@ procedure TMiniBrowserFrm.WMMoving(var aMessage : TMessage);
initialization
GlobalWebView2Loader := TWVLoader.Create(nil);
GlobalWebView2Loader.UserDataFolder := ExtractFileDir(Application.ExeName) + '\CustomCache';
GlobalWebView2Loader.RemoteDebuggingPort := 9222;
GlobalWebView2Loader.StartWebView2;

end.
5 changes: 2 additions & 3 deletions demos/Lazarus/MiniBrowser/MiniBrowser.lpi
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<MainUnitHasUsesSectionForAllUnits Value="False"/>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="MiniBrowser"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
Expand All @@ -25,7 +25,6 @@
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
Expand Down
78 changes: 37 additions & 41 deletions demos/Lazarus/MiniBrowser/MiniBrowser.lps
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="11"/>
<Version Value="12"/>
<BuildModes Active="Default"/>
<Units Count="28">
<Unit0>
<Filename Value="MiniBrowser.lpr"/>
<IsPartOfProject Value="True"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit0>
<Unit1>
<Filename Value="uMiniBrowser.pas"/>
Expand All @@ -20,15 +19,14 @@
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="411"/>
<CursorPos Y="424"/>
<TopLine Value="319"/>
<CursorPos X="75" Y="340"/>
<UsageCount Value="22"/>
<Bookmarks Count="1">
<Item0 Y="222" ID="1"/>
<Item0 X="106" Y="224" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit1>
<Unit2>
<Filename Value="uTextViewerForm.pas"/>
Expand Down Expand Up @@ -216,14 +214,13 @@
</Unit20>
<Unit21>
<Filename Value="..\..\..\source\uWVBrowserBase.pas"/>
<EditorIndex Value="3"/>
<EditorIndex Value="-1"/>
<TopLine Value="305"/>
<CursorPos X="19" Y="322"/>
<UsageCount Value="10"/>
<Bookmarks Count="1">
<Item0 X="27" Y="2319" ID="2"/>
</Bookmarks>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit21>
<Unit22>
Expand Down Expand Up @@ -263,138 +260,137 @@
</Unit26>
<Unit27>
<Filename Value="C:\lazarus\fpc\3.2.0\source\packages\fcl-json\src\fpjson.pp"/>
<EditorIndex Value="2"/>
<EditorIndex Value="-1"/>
<TopLine Value="94"/>
<CursorPos X="3" Y="99"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit27>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="462" Column="65" TopLine="424"/>
<Caret Line="376" Column="58" TopLine="362"/>
</Position1>
<Position2>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="95" Column="78" TopLine="91"/>
<Caret Line="379" Column="87" TopLine="360"/>
</Position2>
<Position3>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="122" Column="27" TopLine="117"/>
<Caret Line="399" Column="48" TopLine="375"/>
</Position3>
<Position4>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="385" Column="63" TopLine="369"/>
<Caret Line="391" TopLine="375"/>
</Position4>
<Position5>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="123" Column="50" TopLine="114"/>
<Caret Line="393" TopLine="375"/>
</Position5>
<Position6>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="396" Column="42" TopLine="383"/>
<Caret Line="394" TopLine="375"/>
</Position6>
<Position7>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="376" Column="58" TopLine="362"/>
<Caret Line="396" TopLine="375"/>
</Position7>
<Position8>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="379" Column="87" TopLine="360"/>
<Caret Line="387" Column="31" TopLine="375"/>
</Position8>
<Position9>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="399" Column="48" TopLine="375"/>
<Caret Line="397" Column="52" TopLine="375"/>
</Position9>
<Position10>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="391" TopLine="375"/>
<Caret Line="396" Column="52" TopLine="374"/>
</Position10>
<Position11>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="393" TopLine="375"/>
<Caret Line="395" Column="52" TopLine="373"/>
</Position11>
<Position12>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="394" TopLine="375"/>
<Caret Line="394" Column="52" TopLine="372"/>
</Position12>
<Position13>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="396" TopLine="375"/>
<Caret Line="293" TopLine="286"/>
</Position13>
<Position14>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="387" Column="31" TopLine="375"/>
<Caret Line="88" Column="27" TopLine="57"/>
</Position14>
<Position15>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="397" Column="52" TopLine="375"/>
<Caret Line="86" Column="29" TopLine="60"/>
</Position15>
<Position16>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="396" Column="52" TopLine="374"/>
<Caret Line="106" Column="43" TopLine="74"/>
</Position16>
<Position17>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="395" Column="52" TopLine="373"/>
<Caret Line="595" Column="50" TopLine="575"/>
</Position17>
<Position18>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="394" Column="52" TopLine="372"/>
<Caret Line="599" Column="64" TopLine="568"/>
</Position18>
<Position19>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="293" TopLine="286"/>
<Caret Line="120" Column="15" TopLine="103"/>
</Position19>
<Position20>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="88" Column="27" TopLine="57"/>
<Caret Line="502" Column="56" TopLine="465"/>
</Position20>
<Position21>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="86" Column="29" TopLine="60"/>
<Caret Line="89" TopLine="57"/>
</Position21>
<Position22>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="106" Column="43" TopLine="74"/>
<Caret Line="340" TopLine="299"/>
</Position22>
<Position23>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="595" Column="50" TopLine="575"/>
<Caret Line="536" Column="41" TopLine="515"/>
</Position23>
<Position24>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="599" Column="64" TopLine="568"/>
<Caret Line="120" Column="15" TopLine="102"/>
</Position24>
<Position25>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="120" Column="15" TopLine="103"/>
<Caret Line="424" TopLine="411"/>
</Position25>
<Position26>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="502" Column="56" TopLine="465"/>
<Caret Line="155" Column="78" TopLine="155"/>
</Position26>
<Position27>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="89" TopLine="57"/>
<Caret Line="225" Column="52" TopLine="211"/>
</Position27>
<Position28>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="340" TopLine="299"/>
<Caret Line="141" TopLine="110"/>
</Position28>
<Position29>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="536" Column="41" TopLine="515"/>
<Caret Line="143" TopLine="112"/>
</Position29>
<Position30>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="120" Column="15" TopLine="102"/>
<Caret Line="229" Column="30" TopLine="227"/>
</Position30>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
<Modes ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>
7 changes: 6 additions & 1 deletion demos/Lazarus/MiniBrowser/uMiniBrowser.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
OnDestroy = FormDestroy
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '2.0.12.0'
LCLVersion = '2.2.0.4'
object NavControlPnl: TPanel
Left = 0
Height = 25
Expand Down Expand Up @@ -310,11 +310,16 @@ object MiniBrowserFrm: TMiniBrowserFrm
end
object MenuItem3: TMenuItem
Caption = 'Available browser version...'
OnClick = MenuItem3Click
end
object ChangeUserAgentMi: TMenuItem
Caption = 'Change user agent string...'
OnClick = ChangeUserAgentMiClick
end
object Muted1: TMenuItem
Caption = 'Muted'
OnClick = Muted1Click
end
end
object OpenDialog1: TOpenDialog
Left = 48
Expand Down
Loading

0 comments on commit ac17ee5

Please sign in to comment.