diff --git a/README.md b/README.md index 234b53a..79a454b 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/bin32/WebView2Loader.dll b/bin32/WebView2Loader.dll index 1fda357..e94b35c 100644 Binary files a/bin32/WebView2Loader.dll and b/bin32/WebView2Loader.dll differ diff --git a/bin64/WebView2Loader.dll b/bin64/WebView2Loader.dll index bf5e230..e382eaf 100644 Binary files a/bin64/WebView2Loader.dll and b/bin64/WebView2Loader.dll differ diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm index cc10f05..f6837a9 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm @@ -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 diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas index d8d5115..02795c2 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas @@ -49,6 +49,7 @@ TMiniBrowserFrm = class(TForm) Availablebrowserversion1: TMenuItem; SaveToFileMi: TMenuItem; Changeuseragentstring1: TMenuItem; + Muted1: TMenuItem; procedure FormShow(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -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; @@ -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); @@ -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; @@ -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); @@ -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. diff --git a/demos/Lazarus/MiniBrowser/MiniBrowser.lpi b/demos/Lazarus/MiniBrowser/MiniBrowser.lpi index 0504f72..e9f8cef 100644 --- a/demos/Lazarus/MiniBrowser/MiniBrowser.lpi +++ b/demos/Lazarus/MiniBrowser/MiniBrowser.lpi @@ -1,7 +1,7 @@ - + @@ -9,9 +9,9 @@ + - <UseAppBundle Value="False"/> <ResourceType Value="res"/> @@ -25,7 +25,6 @@ </PublishOptions> <RunParams> <FormatVersion Value="2"/> - <Modes Count="0"/> </RunParams> <RequiredPackages Count="2"> <Item1> diff --git a/demos/Lazarus/MiniBrowser/MiniBrowser.lps b/demos/Lazarus/MiniBrowser/MiniBrowser.lps index cddebc4..76c9324 100644 --- a/demos/Lazarus/MiniBrowser/MiniBrowser.lps +++ b/demos/Lazarus/MiniBrowser/MiniBrowser.lps @@ -2,7 +2,7 @@ <CONFIG> <ProjectSession> <PathDelim Value="\"/> - <Version Value="11"/> + <Version Value="12"/> <BuildModes Active="Default"/> <Units Count="28"> <Unit0> @@ -10,7 +10,6 @@ <IsPartOfProject Value="True"/> <UsageCount Value="22"/> <Loaded Value="True"/> - <DefaultSyntaxHighlighter Value="Delphi"/> </Unit0> <Unit1> <Filename Value="uMiniBrowser.pas"/> @@ -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"/> @@ -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> @@ -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> diff --git a/demos/Lazarus/MiniBrowser/uMiniBrowser.lfm b/demos/Lazarus/MiniBrowser/uMiniBrowser.lfm index 9b7e2e4..4b5a2c5 100644 --- a/demos/Lazarus/MiniBrowser/uMiniBrowser.lfm +++ b/demos/Lazarus/MiniBrowser/uMiniBrowser.lfm @@ -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 @@ -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 diff --git a/demos/Lazarus/MiniBrowser/uMiniBrowser.pas b/demos/Lazarus/MiniBrowser/uMiniBrowser.pas index 8396ada..2e86be6 100644 --- a/demos/Lazarus/MiniBrowser/uMiniBrowser.pas +++ b/demos/Lazarus/MiniBrowser/uMiniBrowser.pas @@ -15,6 +15,7 @@ interface { TMiniBrowserFrm } TMiniBrowserFrm = class(TForm) + Muted1: TMenuItem; SaveToFileMi: TMenuItem; MenuItem3: TMenuItem; ChangeUserAgentMi: TMenuItem; @@ -57,6 +58,8 @@ TMiniBrowserFrm = class(TForm) procedure FormShow(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); + procedure MenuItem3Click(Sender: TObject); + procedure Muted1Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure PopupMenu1Popup(Sender: TObject); @@ -137,9 +140,6 @@ implementation uWVCoreWebView2WebResourceResponseView, uWVCoreWebView2HttpResponseHeaders, uWVCoreWebView2HttpHeadersCollectionIterator; -const - SAVE_MHTML_EXEC_ID = 1; - procedure TMiniBrowserFrm.akesnapshot1Click(Sender: TObject); var TempAdapter : IStream; @@ -219,6 +219,16 @@ procedure TMiniBrowserFrm.FormDestroy(Sender: TObject); FreeAndNil(FDownloadOperation); end; +procedure TMiniBrowserFrm.MenuItem3Click(Sender: TObject); +begin + showmessage('Available browser version : ' + UTF8Encode(GlobalWebView2Loader.AvailableBrowserVersion)); +end; + +procedure TMiniBrowserFrm.Muted1Click(Sender: TObject); +begin + WVBrowser1.ToggleMuteState; +end; + procedure TMiniBrowserFrm.ChangeUserAgentMiClick(Sender: TObject); var TempUA : wvstring; @@ -310,7 +320,8 @@ procedure TMiniBrowserFrm.PopupMenu1Popup(Sender: TObject); begin Blockimages1.Checked := FBlockImages; Offline1.Checked := WVBrowser1.Offline; - Ignorecertificateerrors1.Checked := WVBrowser1.IgnoreCertificateErrors; + Ignorecertificateerrors1.Checked := WVBrowser1.IgnoreCertificateErrors; + Muted1.Checked := WVBrowser1.IsMuted; end; procedure TMiniBrowserFrm.Print1Click(Sender: TObject); diff --git a/packages/webview4delphi.lpk b/packages/webview4delphi.lpk index 2aacfdb..e8e24c3 100644 --- a/packages/webview4delphi.lpk +++ b/packages/webview4delphi.lpk @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <CONFIG> - <Package Version="4"> + <Package Version="5"> <PathDelim Value="\"/> <Name Value="WebView4Delphi"/> <Type Value="RunAndDesignTime"/> @@ -12,7 +12,7 @@ <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> </SearchPaths> </CompilerOptions> - <Version Major="1" Release="1054" Build="31"/> + <Version Major="1" Release="1072" Build="54"/> <Files Count="41"> <Item1> <Filename Value="..\source\uWVBrowser.pas"/> @@ -181,6 +181,7 @@ <UnitName Value="uWVWindowParent"/> </Item41> </Files> + <CompatibilityMode Value="True"/> <RequiredPkgs Count="2"> <Item1> <PackageName Value="LCLBase"/> diff --git a/source/uWVBrowserBase.pas b/source/uWVBrowserBase.pas index feb2f69..5d77b3a 100644 --- a/source/uWVBrowserBase.pas +++ b/source/uWVBrowserBase.pas @@ -120,6 +120,9 @@ TWVBrowserBase = class(TComponent, IWVBrowserEvents) FOnIgnoreCertificateErrorsCompleted : TOnIgnoreCertificateErrorsCompletedEvent; FOnRefreshIgnoreCacheCompleted : TOnRefreshIgnoreCacheCompletedEvent; FOnSimulateKeyEventCompleted : TOnSimulateKeyEventCompletedEvent; + FOnIsMutedChanged : TOnIsMutedChangedEvent; + FOnIsDocumentPlayingAudioChanged : TOnIsDocumentPlayingAudioChangedEvent; + FOnIsDefaultDownloadDialogOpenChanged : TOnIsDefaultDownloadDialogOpenChangedEvent; function GetBrowserProcessID : cardinal; function GetBrowserVersionInfo : wvstring; @@ -160,19 +163,24 @@ TWVBrowserBase = class(TComponent, IWVBrowserEvents) function GetCursor : HCURSOR; function GetSystemCursorID : cardinal; function GetUIAProvider : IUnknown; - - procedure SetBuiltInErrorPageEnabled(const Value: boolean); - procedure SetDefaultContextMenusEnabled(const Value: boolean); - procedure SetDefaultScriptDialogsEnabled(const Value: boolean); - procedure SetDevToolsEnabled(const Value: boolean); - procedure SetScriptEnabled(const Value: boolean); - procedure SetStatusBarEnabled(const Value: boolean); - procedure SetWebMessageEnabled(const Value: boolean); - procedure SetZoomControlEnabled(const Value: boolean); - procedure SetZoomFactor(const Value: Double); + function GetIsMuted : boolean; + function GetIsDocumentPlayingAudio : boolean; + function GetIsDefaultDownloadDialogOpen : boolean; + function GetDefaultDownloadDialogCornerAlignment : TWVDefaultDownloadDialogCornerAlignment; + function GetDefaultDownloadDialogMargin : TPoint; + + procedure SetBuiltInErrorPageEnabled(aValue: boolean); + procedure SetDefaultContextMenusEnabled(aValue: boolean); + procedure SetDefaultScriptDialogsEnabled(aValue: boolean); + procedure SetDevToolsEnabled(aValue: boolean); + procedure SetScriptEnabled(aValue: boolean); + procedure SetStatusBarEnabled(aValue: boolean); + procedure SetWebMessageEnabled(aValue: boolean); + procedure SetZoomControlEnabled(aValue: boolean); + procedure SetZoomFactor(const aValue: Double); procedure SetZoomPct(const aValue : double); procedure SetZoomStep(aValue : byte); - procedure SetIsVisible(const aValue : boolean); + procedure SetIsVisible(aValue : boolean); procedure SetBounds(aValue : TRect); procedure SetParentWindow(aValue : THandle); procedure SetDefaultBackgroundColor(const aValue : TColor); @@ -189,6 +197,9 @@ TWVBrowserBase = class(TComponent, IWVBrowserEvents) procedure SetOffline(aValue : boolean); procedure SetIgnoreCertificateErrors(aValue : boolean); procedure SetRootVisualTarget(const aValue : IUnknown); + procedure SetIsMuted(aValue : boolean); + procedure SetDefaultDownloadDialogCornerAlignment(aValue : TWVDefaultDownloadDialogCornerAlignment); + procedure SetDefaultDownloadDialogMargin(aValue : TPoint); function CreateEnvironment : boolean; @@ -262,6 +273,9 @@ TWVBrowserBase = class(TComponent, IWVBrowserEvents) function FrameDestroyedEventHandler_Invoke(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer): HRESULT; function CallDevToolsProtocolMethodCompletedHandler_Invoke(errorCode: HResult; returnObjectAsJson: PWideChar; aExecutionID : integer): HRESULT; function AddScriptToExecuteOnDocumentCreatedCompletedHandler_Invoke(errorCode: HResult; id: PWideChar): HRESULT; + function IsMutedChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT; + function IsDocumentPlayingAudioChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT; + function IsDefaultDownloadDialogOpenChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT; procedure doOnInitializationError(aErrorCode: HRESULT; const aErrorMessage: wvstring); virtual; procedure doOnEnvironmentCompleted; virtual; @@ -321,6 +335,9 @@ TWVBrowserBase = class(TComponent, IWVBrowserEvents) procedure doOnIgnoreCertificateErrorsCompleted(aErrorCode: HRESULT); virtual; procedure doOnRefreshIgnoreCacheCompleted(aErrorCode: HRESULT; const aResultObjectAsJson: wvstring); virtual; procedure doOnSimulateKeyEventCompleted(aErrorCode: HRESULT); virtual; + procedure doOnIsMutedChanged(const sender: ICoreWebView2); virtual; + procedure doOnIsDocumentPlayingAudioChanged(const sender: ICoreWebView2); virtual; + procedure doOnIsDefaultDownloadDialogOpenChanged(const sender: ICoreWebView2); virtual; public constructor Create(AOwner: TComponent); override; @@ -404,6 +421,8 @@ TWVBrowserBase = class(TComponent, IWVBrowserEvents) procedure ResetZoom; function SetBoundsAndZoomFactor(aBounds: TRect; const aZoomFactor: double) : boolean; + procedure ToggleMuteState; + function SimulateEditingCommand(aEditingCommand : TWV2EditingCommand): boolean; function SimulateKeyEvent(type_: TWV2KeyEventType; modifiers, windowsVirtualKeyCode, nativeVirtualKeyCode: integer; timestamp: integer = 0; location: integer = 0; autoRepeat: boolean = False; isKeypad: boolean = False; isSystemKey: boolean = False; const text: wvstring = ''; const unmodifiedtext: wvstring = ''; const keyIdentifier: wvstring = ''; const code: wvstring = ''; const key: wvstring = ''): boolean; virtual; function KeyboardShortcutSearch : boolean; virtual; @@ -471,6 +490,11 @@ TWVBrowserBase = class(TComponent, IWVBrowserEvents) property Widget1CompHWND : THandle read FWidget1CompHWND; property RenderCompHWND : THandle read FRenderCompHWND; property D3DWindowCompHWND : THandle read FD3DWindowCompHWND; + property IsMuted : boolean read GetIsMuted write SetIsMuted; + property IsDocumentPlayingAudio : boolean read GetIsDocumentPlayingAudio; + property IsDefaultDownloadDialogOpen : boolean read GetIsDefaultDownloadDialogOpen; + property DefaultDownloadDialogCornerAlignment : TWVDefaultDownloadDialogCornerAlignment read GetDefaultDownloadDialogCornerAlignment write SetDefaultDownloadDialogCornerAlignment; + property DefaultDownloadDialogMargin : TPoint read GetDefaultDownloadDialogMargin write SetDefaultDownloadDialogMargin; property OnInitializationError : TOnInitializationErrorEvent read FOnInitializationError write FOnInitializationError; property OnEnvironmentCompleted : TNotifyEvent read FOnEnvironmentCompleted write FOnEnvironmentCompleted; @@ -534,6 +558,9 @@ TWVBrowserBase = class(TComponent, IWVBrowserEvents) property OnIgnoreCertificateErrorsCompleted : TOnIgnoreCertificateErrorsCompletedEvent read FOnIgnoreCertificateErrorsCompleted write FOnIgnoreCertificateErrorsCompleted; property OnRefreshIgnoreCacheCompleted : TOnRefreshIgnoreCacheCompletedEvent read FOnRefreshIgnoreCacheCompleted write FOnRefreshIgnoreCacheCompleted; property OnSimulateKeyEventCompleted : TOnSimulateKeyEventCompletedEvent read FOnSimulateKeyEventCompleted write FOnSimulateKeyEventCompleted; + property OnIsMutedChanged : TOnIsMutedChangedEvent read FOnIsMutedChanged write FOnIsMutedChanged; + property OnIsDocumentPlayingAudioChanged : TOnIsDocumentPlayingAudioChangedEvent read FOnIsDocumentPlayingAudioChanged write FOnIsDocumentPlayingAudioChanged; + property OnIsDefaultDownloadDialogOpenChanged : TOnIsDefaultDownloadDialogOpenChangedEvent read FOnIsDefaultDownloadDialogOpenChanged write FOnIsDefaultDownloadDialogOpenChanged; end; implementation @@ -637,6 +664,9 @@ constructor TWVBrowserBase.Create(AOwner: TComponent); FOnIgnoreCertificateErrorsCompleted := nil; FOnRefreshIgnoreCacheCompleted := nil; FOnSimulateKeyEventCompleted := nil; + FOnIsMutedChanged := nil; + FOnIsDocumentPlayingAudioChanged := nil; + FOnIsDefaultDownloadDialogOpenChanged := nil; end; destructor TWVBrowserBase.Destroy; @@ -1428,6 +1458,24 @@ procedure TWVBrowserBase.doOnSimulateKeyEventCompleted(aErrorCode: HRESULT); FOnSimulateKeyEventCompleted(self, succeeded(aErrorCode)); end; +procedure TWVBrowserBase.doOnIsMutedChanged(const sender: ICoreWebView2); +begin + if assigned(FOnIsMutedChanged) then + FOnIsMutedChanged(self, sender); +end; + +procedure TWVBrowserBase.doOnIsDocumentPlayingAudioChanged(const sender: ICoreWebView2); +begin + if assigned(FOnIsDocumentPlayingAudioChanged) then + FOnIsDocumentPlayingAudioChanged(self, sender); +end; + +procedure TWVBrowserBase.doOnIsDefaultDownloadDialogOpenChanged(const sender: ICoreWebView2); +begin + if assigned(FOnIsDefaultDownloadDialogOpenChanged) then + FOnIsDefaultDownloadDialogOpenChanged(self, sender); +end; + procedure TWVBrowserBase.doOnRetrieveMHTMLCompleted(aErrorCode: HRESULT; const aReturnObjectAsJson: wvstring); var TempMHTML : wvstring; @@ -1539,6 +1587,24 @@ function TWVBrowserBase.AddScriptToExecuteOnDocumentCreatedCompletedHandler_Invo doOnAddScriptToExecuteOnDocumentCreatedCompletedEvent(errorCode, wvstring(id)); end; +function TWVBrowserBase.IsMutedChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT; +begin + Result := S_OK; + doOnIsMutedChanged(sender); +end; + +function TWVBrowserBase.IsDocumentPlayingAudioChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT; +begin + Result := S_OK; + doOnIsDocumentPlayingAudioChanged(sender); +end; + +function TWVBrowserBase.IsDefaultDownloadDialogOpenChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT; +begin + Result := S_OK; + doOnIsDefaultDownloadDialogOpenChanged(sender); +end; + function TWVBrowserBase.ExecuteScriptCompletedHandler_Invoke(errorCode: HRESULT; resultObjectAsJson: PWideChar; aExecutionID : integer): HRESULT; begin Result := S_OK; @@ -1703,6 +1769,40 @@ function TWVBrowserBase.GetUIAProvider : IUnknown; Result := nil; end; +function TWVBrowserBase.GetIsMuted : boolean; +begin + Result := Initialized and + FCoreWebView2.IsMuted; +end; + +function TWVBrowserBase.GetIsDocumentPlayingAudio : boolean; +begin + Result := Initialized and + FCoreWebView2.IsDocumentPlayingAudio; +end; + +function TWVBrowserBase.GetIsDefaultDownloadDialogOpen : boolean; +begin + Result := Initialized and + FCoreWebView2.IsDefaultDownloadDialogOpen; +end; + +function TWVBrowserBase.GetDefaultDownloadDialogCornerAlignment : TWVDefaultDownloadDialogCornerAlignment; +begin + if Initialized then + Result := FCoreWebView2.DefaultDownloadDialogCornerAlignment + else + Result := 0; +end; + +function TWVBrowserBase.GetDefaultDownloadDialogMargin : TPoint; +begin + if Initialized then + Result := FCoreWebView2.DefaultDownloadDialogMargin + else + Result := point(0, 0); +end; + function TWVBrowserBase.GetCanGoBack: boolean; begin Result := Initialized and @@ -2063,28 +2163,28 @@ procedure TWVBrowserBase.SetIsSwipeNavigationEnabled(aValue : boolean); FCoreWebView2Settings.IsSwipeNavigationEnabled := aValue; end; -procedure TWVBrowserBase.SetBuiltInErrorPageEnabled(const Value: boolean); +procedure TWVBrowserBase.SetBuiltInErrorPageEnabled(aValue: boolean); begin if Initialized then - FCoreWebView2Settings.IsBuiltInErrorPageEnabled := Value; + FCoreWebView2Settings.IsBuiltInErrorPageEnabled := aValue; end; -procedure TWVBrowserBase.SetDefaultContextMenusEnabled(const Value: boolean); +procedure TWVBrowserBase.SetDefaultContextMenusEnabled(aValue: boolean); begin if Initialized then - FCoreWebView2Settings.AreDefaultContextMenusEnabled := Value; + FCoreWebView2Settings.AreDefaultContextMenusEnabled := aValue; end; -procedure TWVBrowserBase.SetDefaultScriptDialogsEnabled(const Value: boolean); +procedure TWVBrowserBase.SetDefaultScriptDialogsEnabled(aValue: boolean); begin if Initialized then - FCoreWebView2Settings.AreDefaultScriptDialogsEnabled := Value; + FCoreWebView2Settings.AreDefaultScriptDialogsEnabled := aValue; end; -procedure TWVBrowserBase.SetDevToolsEnabled(const Value: boolean); +procedure TWVBrowserBase.SetDevToolsEnabled(aValue: boolean); begin if Initialized then - FCoreWebView2Settings.AreDevToolsEnabled := Value; + FCoreWebView2Settings.AreDevToolsEnabled := aValue; end; function TWVBrowserBase.SetFocus : boolean; @@ -2117,6 +2217,12 @@ function TWVBrowserBase.NotifyParentWindowPositionChanged : boolean; FCoreWebView2Controller.NotifyParentWindowPositionChanged; end; +procedure TWVBrowserBase.ToggleMuteState; +begin + if Initialized then + FCoreWebView2.IsMuted := not(FCoreWebView2.IsMuted); +end; + function TWVBrowserBase.TrySuspend : boolean; var TempHandler : ICoreWebView2TrySuspendCompletedHandler; @@ -2436,6 +2542,24 @@ procedure TWVBrowserBase.SetRootVisualTarget(const aValue : IUnknown); FCoreWebView2CompositionController.RootVisualTarget := aValue; end; +procedure TWVBrowserBase.SetIsMuted(aValue : boolean); +begin + if Initialized then + FCoreWebView2.IsMuted := aValue; +end; + +procedure TWVBrowserBase.SetDefaultDownloadDialogCornerAlignment(aValue : TWVDefaultDownloadDialogCornerAlignment); +begin + if Initialized then + FCoreWebView2.DefaultDownloadDialogCornerAlignment := aValue; +end; + +procedure TWVBrowserBase.SetDefaultDownloadDialogMargin(aValue : TPoint); +begin + if Initialized then + FCoreWebView2.DefaultDownloadDialogMargin := aValue; +end; + procedure TWVBrowserBase.IncZoomStep; begin UpdateZoomStep(True); @@ -2451,34 +2575,34 @@ procedure TWVBrowserBase.ResetZoom; ZoomStep := ZOOM_STEP_DEF; end; -procedure TWVBrowserBase.SetScriptEnabled(const Value: boolean); +procedure TWVBrowserBase.SetScriptEnabled(aValue: boolean); begin if Initialized then - FCoreWebView2Settings.IsScriptEnabled := Value; + FCoreWebView2Settings.IsScriptEnabled := aValue; end; -procedure TWVBrowserBase.SetStatusBarEnabled(const Value: boolean); +procedure TWVBrowserBase.SetStatusBarEnabled(aValue: boolean); begin if Initialized then - FCoreWebView2Settings.IsStatusBarEnabled := Value; + FCoreWebView2Settings.IsStatusBarEnabled := aValue; end; -procedure TWVBrowserBase.SetWebMessageEnabled(const Value: boolean); +procedure TWVBrowserBase.SetWebMessageEnabled(aValue: boolean); begin if Initialized then - FCoreWebView2Settings.IsWebMessageEnabled := Value; + FCoreWebView2Settings.IsWebMessageEnabled := aValue; end; -procedure TWVBrowserBase.SetZoomControlEnabled(const Value: boolean); +procedure TWVBrowserBase.SetZoomControlEnabled(aValue: boolean); begin if Initialized then - FCoreWebView2Settings.IsZoomControlEnabled := Value; + FCoreWebView2Settings.IsZoomControlEnabled := aValue; end; -procedure TWVBrowserBase.SetZoomFactor(const Value: Double); +procedure TWVBrowserBase.SetZoomFactor(const aValue: Double); begin if Initialized then - FCoreWebView2Controller.ZoomFactor := Value; + FCoreWebView2Controller.ZoomFactor := aValue; end; procedure TWVBrowserBase.SetZoomPct(const aValue : double); @@ -2512,7 +2636,7 @@ procedure TWVBrowserBase.SetZoomStep(aValue : byte); end; end; -procedure TWVBrowserBase.SetIsVisible(const aValue : boolean); +procedure TWVBrowserBase.SetIsVisible(aValue : boolean); begin if Initialized then FCoreWebView2Controller.IsVisible := aValue; diff --git a/source/uWVConstants.pas b/source/uWVConstants.pas index cc6b0e2..5037dc2 100644 --- a/source/uWVConstants.pas +++ b/source/uWVConstants.pas @@ -7,13 +7,13 @@ interface const WEBVIEW2LOADERLIB_VERSION_MAJOR = 1; WEBVIEW2LOADERLIB_VERSION_MINOR = 0; - WEBVIEW2LOADERLIB_VERSION_RELEASE = 1054; - WEBVIEW2LOADERLIB_VERSION_BUILD = 31; + WEBVIEW2LOADERLIB_VERSION_RELEASE = 1072; + WEBVIEW2LOADERLIB_VERSION_BUILD = 54; - CHROMIUM_VERSION_MAJOR = 96; + CHROMIUM_VERSION_MAJOR = 97; CHROMIUM_VERSION_MINOR = 0; - CHROMIUM_VERSION_RELEASE = 4664; - CHROMIUM_VERSION_BUILD = 110; + CHROMIUM_VERSION_RELEASE = 1072; + CHROMIUM_VERSION_BUILD = 55; CRLF = #13 + #10; diff --git a/source/uWVCoreWebView2.pas b/source/uWVCoreWebView2.pas index 5761f2d..33c16c9 100644 --- a/source/uWVCoreWebView2.pas +++ b/source/uWVCoreWebView2.pas @@ -6,46 +6,51 @@ interface uses {$IFDEF FPC} - Classes, Windows, ActiveX, SysUtils, + Classes, Windows, ActiveX, SysUtils, Types, {$ELSE} - System.Classes, WinApi.Windows, Winapi.ActiveX, System.SysUtils, + System.Classes, WinApi.Windows, Winapi.ActiveX, System.SysUtils, System.Types, {$ENDIF} uWVTypeLibrary, uWVTypes; type TCoreWebView2 = class protected - FBaseIntf : ICoreWebView2; - FBaseIntf2 : ICoreWebView2_2; - FBaseIntf3 : ICoreWebView2_3; - FBaseIntf4 : ICoreWebView2_4; - FBaseIntf5 : ICoreWebView2_5; - FBaseIntf6 : ICoreWebView2_6; - FBaseIntf7 : ICoreWebView2_7; - FContainsFullScreenElementChangedToken : EventRegistrationToken; - FContentLoadingToken : EventRegistrationToken; - FDocumentTitleChangedToken : EventRegistrationToken; - FFrameNavigationStartingToken : EventRegistrationToken; - FFrameNavigationCompletedToken : EventRegistrationToken; - FHistoryChangedToken : EventRegistrationToken; - FNavigationStartingToken : EventRegistrationToken; - FNavigationCompletedToken : EventRegistrationToken; - FNewWindowRequestedToken : EventRegistrationToken; - FPermissionRequestedToken : EventRegistrationToken; - FProcessFailedToken : EventRegistrationToken; - FScriptDialogOpeningToken : EventRegistrationToken; - FSourceChangedToken : EventRegistrationToken; - FWebResourceRequestedToken : EventRegistrationToken; - FWebMessageReceivedToken : EventRegistrationToken; - FWindowCloseRequestedToken : EventRegistrationToken; - FWebResourceResponseReceivedToken : EventRegistrationToken; - FDOMContentLoadedToken : EventRegistrationToken; - FFrameCreatedToken : EventRegistrationToken; - FDownloadStartingToken : EventRegistrationToken; - FClientCertificateRequestedToken : EventRegistrationToken; - - FDevToolsEventNames : TStringList; - FDevToolsEventTokens : array of EventRegistrationToken; + FBaseIntf : ICoreWebView2; + FBaseIntf2 : ICoreWebView2_2; + FBaseIntf3 : ICoreWebView2_3; + FBaseIntf4 : ICoreWebView2_4; + FBaseIntf5 : ICoreWebView2_5; + FBaseIntf6 : ICoreWebView2_6; + FBaseIntf7 : ICoreWebView2_7; + FBaseIntf8 : ICoreWebView2_8; + FBaseIntf9 : ICoreWebView2_9; + FContainsFullScreenElementChangedToken : EventRegistrationToken; + FContentLoadingToken : EventRegistrationToken; + FDocumentTitleChangedToken : EventRegistrationToken; + FFrameNavigationStartingToken : EventRegistrationToken; + FFrameNavigationCompletedToken : EventRegistrationToken; + FHistoryChangedToken : EventRegistrationToken; + FNavigationStartingToken : EventRegistrationToken; + FNavigationCompletedToken : EventRegistrationToken; + FNewWindowRequestedToken : EventRegistrationToken; + FPermissionRequestedToken : EventRegistrationToken; + FProcessFailedToken : EventRegistrationToken; + FScriptDialogOpeningToken : EventRegistrationToken; + FSourceChangedToken : EventRegistrationToken; + FWebResourceRequestedToken : EventRegistrationToken; + FWebMessageReceivedToken : EventRegistrationToken; + FWindowCloseRequestedToken : EventRegistrationToken; + FWebResourceResponseReceivedToken : EventRegistrationToken; + FDOMContentLoadedToken : EventRegistrationToken; + FFrameCreatedToken : EventRegistrationToken; + FDownloadStartingToken : EventRegistrationToken; + FClientCertificateRequestedToken : EventRegistrationToken; + FIsMutedChangedToken : EventRegistrationToken; + FIsDocumentPlayingAudioChangedToken : EventRegistrationToken; + FIsDefaultDownloadDialogOpenChangedToken : EventRegistrationToken; + + FDevToolsEventNames : TStringList; + FDevToolsEventTokens : array of EventRegistrationToken; function GetInitialized : boolean; function GetBrowserProcessID : cardinal; @@ -58,6 +63,15 @@ TCoreWebView2 = class function GetEnvironment : ICoreWebView2Environment; function GetIsSuspended : boolean; function GetSettings : ICoreWebView2Settings; + function GetIsMuted : boolean; + function GetIsDocumentPlayingAudio : boolean; + function GetIsDefaultDownloadDialogOpen : boolean; + function GetDefaultDownloadDialogCornerAlignment : TWVDefaultDownloadDialogCornerAlignment; + function GetDefaultDownloadDialogMargin : TPoint; + + procedure SetIsMuted(aValue : boolean); + procedure SetDefaultDownloadDialogCornerAlignment(aValue : TWVDefaultDownloadDialogCornerAlignment); + procedure SetDefaultDownloadDialogMargin(aValue : TPoint); procedure InitializeFields; procedure InitializeTokens; @@ -85,6 +99,9 @@ TCoreWebView2 = class function AddFrameCreatedEvent(const aBrowserComponent : TComponent) : boolean; function AddDownloadStartingEvent(const aBrowserComponent : TComponent) : boolean; function AddClientCertificateRequestedEvent(const aBrowserComponent : TComponent) : boolean; + function AddIsMutedChangedEvent(const aBrowserComponent : TComponent) : boolean; + function AddIsDocumentPlayingAudioChangedEvent(const aBrowserComponent : TComponent) : boolean; + function AddIsDefaultDownloadDialogOpenChangedEvent(const aBrowserComponent : TComponent) : boolean; public constructor Create(const aBaseIntf : ICoreWebView2); reintroduce; @@ -117,19 +134,26 @@ TCoreWebView2 = class function RemoveHostObjectFromScript(const aName : wvstring) : boolean; function AddScriptToExecuteOnDocumentCreated(const JavaScript : wvstring; const aBrowserComponent : TComponent) : boolean; function RemoveScriptToExecuteOnDocumentCreated(const aID : wvstring) : boolean; - - property Initialized : boolean read GetInitialized; - property BaseIntf : ICoreWebView2 read FBaseIntf; - property Settings : ICoreWebView2Settings read GetSettings; - property BrowserProcessID : DWORD read GetBrowserProcessID; - property CanGoBack : boolean read GetCanGoBack; - property CanGoForward : boolean read GetCanGoForward; - property ContainsFullScreenElement : boolean read GetContainsFullScreenElement; - property DocumentTitle : wvstring read GetDocumentTitle; - property Source : wvstring read GetSource; - property CookieManager : ICoreWebView2CookieManager read GetCookieManager; - property Environment : ICoreWebView2Environment read GetEnvironment; - property IsSuspended : boolean read GetIsSuspended; + function OpenDefaultDownloadDialog : boolean; + function CloseDefaultDownloadDialog : boolean; + + property Initialized : boolean read GetInitialized; + property BaseIntf : ICoreWebView2 read FBaseIntf; + property Settings : ICoreWebView2Settings read GetSettings; + property BrowserProcessID : DWORD read GetBrowserProcessID; + property CanGoBack : boolean read GetCanGoBack; + property CanGoForward : boolean read GetCanGoForward; + property ContainsFullScreenElement : boolean read GetContainsFullScreenElement; + property DocumentTitle : wvstring read GetDocumentTitle; + property Source : wvstring read GetSource; + property CookieManager : ICoreWebView2CookieManager read GetCookieManager; + property Environment : ICoreWebView2Environment read GetEnvironment; + property IsSuspended : boolean read GetIsSuspended; + property IsMuted : boolean read GetIsMuted write SetIsMuted; + property IsDocumentPlayingAudio : boolean read GetIsDocumentPlayingAudio; + property IsDefaultDownloadDialogOpen : boolean read GetIsDefaultDownloadDialogOpen; + property DefaultDownloadDialogCornerAlignment : TWVDefaultDownloadDialogCornerAlignment read GetDefaultDownloadDialogCornerAlignment write SetDefaultDownloadDialogCornerAlignment; + property DefaultDownloadDialogMargin : TPoint read GetDefaultDownloadDialogMargin write SetDefaultDownloadDialogMargin; end; implementation @@ -150,8 +174,10 @@ constructor TCoreWebView2.Create(const aBaseIntf : ICoreWebView2); succeeded(FBaseIntf.QueryInterface(IID_ICoreWebView2_3, FBaseIntf3)) and succeeded(FBaseIntf.QueryInterface(IID_ICoreWebView2_4, FBaseIntf4)) and succeeded(FBaseIntf.QueryInterface(IID_ICoreWebView2_5, FBaseIntf5)) and - succeeded(FBaseIntf.QueryInterface(IID_ICoreWebView2_6, FBaseIntf6)) then - FBaseIntf.QueryInterface(IID_ICoreWebView2_7, FBaseIntf7); + succeeded(FBaseIntf.QueryInterface(IID_ICoreWebView2_6, FBaseIntf6)) and + succeeded(FBaseIntf.QueryInterface(IID_ICoreWebView2_7, FBaseIntf7)) and + succeeded(FBaseIntf.QueryInterface(IID_ICoreWebView2_8, FBaseIntf8)) then + FBaseIntf.QueryInterface(IID_ICoreWebView2_9, FBaseIntf9); end; destructor TCoreWebView2.Destroy; @@ -190,6 +216,8 @@ procedure TCoreWebView2.InitializeFields; FBaseIntf5 := nil; FBaseIntf6 := nil; FBaseIntf7 := nil; + FBaseIntf8 := nil; + FBaseIntf9 := nil; FDevToolsEventTokens := nil; FDevToolsEventNames := nil; @@ -198,27 +226,30 @@ procedure TCoreWebView2.InitializeFields; procedure TCoreWebView2.InitializeTokens; begin - FContainsFullScreenElementChangedToken.value := 0; - FContentLoadingToken.value := 0; - FDocumentTitleChangedToken.value := 0; - FFrameNavigationStartingToken.value := 0; - FFrameNavigationCompletedToken.value := 0; - FHistoryChangedToken.value := 0; - FNavigationStartingToken.value := 0; - FNavigationCompletedToken.value := 0; - FNewWindowRequestedToken.value := 0; - FPermissionRequestedToken.value := 0; - FProcessFailedToken.value := 0; - FScriptDialogOpeningToken.value := 0; - FSourceChangedToken.value := 0; - FWebResourceRequestedToken.value := 0; - FWebMessageReceivedToken.value := 0; - FWindowCloseRequestedToken.value := 0; - FWebResourceResponseReceivedToken.value := 0; - FDOMContentLoadedToken.value := 0; - FFrameCreatedToken.value := 0; - FDownloadStartingToken.value := 0; - FClientCertificateRequestedToken.value := 0; + FContainsFullScreenElementChangedToken.value := 0; + FContentLoadingToken.value := 0; + FDocumentTitleChangedToken.value := 0; + FFrameNavigationStartingToken.value := 0; + FFrameNavigationCompletedToken.value := 0; + FHistoryChangedToken.value := 0; + FNavigationStartingToken.value := 0; + FNavigationCompletedToken.value := 0; + FNewWindowRequestedToken.value := 0; + FPermissionRequestedToken.value := 0; + FProcessFailedToken.value := 0; + FScriptDialogOpeningToken.value := 0; + FSourceChangedToken.value := 0; + FWebResourceRequestedToken.value := 0; + FWebMessageReceivedToken.value := 0; + FWindowCloseRequestedToken.value := 0; + FWebResourceResponseReceivedToken.value := 0; + FDOMContentLoadedToken.value := 0; + FFrameCreatedToken.value := 0; + FDownloadStartingToken.value := 0; + FClientCertificateRequestedToken.value := 0; + FIsMutedChangedToken.value := 0; + FIsDocumentPlayingAudioChangedToken.value := 0; + FIsDefaultDownloadDialogOpenChangedToken.value := 0; end; function TCoreWebView2.GetInitialized : boolean; @@ -305,6 +336,19 @@ procedure TCoreWebView2.RemoveAllEvents; // FBaseIntf5.remove_ClientCertificateRequested(FClientCertificateRequestedToken); end; + if assigned(FBaseIntf8) then + begin + if (FIsMutedChangedToken.value <> 0) then + FBaseIntf8.remove_IsMutedChanged(FIsMutedChangedToken); + + if (FIsDocumentPlayingAudioChangedToken.value <> 0) then + FBaseIntf8.remove_IsDocumentPlayingAudioChanged(FIsDocumentPlayingAudioChangedToken); + end; + + if assigned(FBaseIntf9) and + (FIsDefaultDownloadDialogOpenChangedToken.value <> 0) then + FBaseIntf9.remove_IsDefaultDownloadDialogOpenChanged(FIsDefaultDownloadDialogOpenChangedToken); + UnsubscribeAllDevToolsProtocolEvents; end; except @@ -632,29 +676,77 @@ function TCoreWebView2.AddClientCertificateRequestedEvent(const aBrowserComponen end; end; +function TCoreWebView2.AddIsMutedChangedEvent(const aBrowserComponent : TComponent) : boolean; +var + TempHandler : ICoreWebView2IsMutedChangedEventHandler; +begin + Result := False; + + if assigned(FBaseIntf8) and (FIsMutedChangedToken.value = 0) then + try + TempHandler := TCoreWebView2IsMutedChangedEventHandler.Create(TWVBrowserBase(aBrowserComponent)); + Result := succeeded(FBaseIntf8.add_IsMutedChanged(TempHandler, FIsMutedChangedToken)); + finally + TempHandler := nil; + end; +end; + +function TCoreWebView2.AddIsDocumentPlayingAudioChangedEvent(const aBrowserComponent : TComponent) : boolean; +var + TempHandler : ICoreWebView2IsDocumentPlayingAudioChangedEventHandler; +begin + Result := False; + + if assigned(FBaseIntf8) and (FIsDocumentPlayingAudioChangedToken.value = 0) then + try + TempHandler := TCoreWebView2IsDocumentPlayingAudioChangedEventHandler.Create(TWVBrowserBase(aBrowserComponent)); + Result := succeeded(FBaseIntf8.add_IsDocumentPlayingAudioChanged(TempHandler, FIsDocumentPlayingAudioChangedToken)); + finally + TempHandler := nil; + end; +end; + +function TCoreWebView2.AddIsDefaultDownloadDialogOpenChangedEvent(const aBrowserComponent : TComponent) : boolean; +var + TempHandler : ICoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler; +begin + Result := False; + + if assigned(FBaseIntf9) and (FIsDefaultDownloadDialogOpenChangedToken.value = 0) then + try + TempHandler := TCoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler.Create(TWVBrowserBase(aBrowserComponent)); + Result := succeeded(FBaseIntf9.add_IsDefaultDownloadDialogOpenChanged(TempHandler, FIsDefaultDownloadDialogOpenChangedToken)); + finally + TempHandler := nil; + end; +end; + function TCoreWebView2.AddAllBrowserEvents(const aBrowserComponent : TComponent) : boolean; begin - Result := AddNavigationStartingEvent(aBrowserComponent) and - AddNavigationCompletedEvent(aBrowserComponent) and - AddSourceChangedEvent(aBrowserComponent) and - AddHistoryChangedEvent(aBrowserComponent) and - AddContentLoadingEvent(aBrowserComponent) and - AddDocumentTitleChangedEvent(aBrowserComponent) and - AddNewWindowRequestedEvent(aBrowserComponent) and - AddFrameNavigationStartingEvent(aBrowserComponent) and - AddFrameNavigationCompletedEvent(aBrowserComponent) and - AddWebResourceRequestedEvent(aBrowserComponent) and - AddScriptDialogOpeningEvent(aBrowserComponent) and - AddPermissionRequestedEvent(aBrowserComponent) and - AddProcessFailedEvent(aBrowserComponent) and - AddWebMessageReceivedEvent(aBrowserComponent) and - AddContainsFullScreenElementChangedEvent(aBrowserComponent) and - AddWindowCloseRequestedEvent(aBrowserComponent) and - AddWebResourceResponseReceivedEvent(aBrowserComponent) and - AddDOMContentLoadedEvent(aBrowserComponent) and - AddFrameCreatedEvent(aBrowserComponent) and - AddDownloadStartingEvent(aBrowserComponent) and - AddClientCertificateRequestedEvent(aBrowserComponent); + Result := AddNavigationStartingEvent(aBrowserComponent) and + AddNavigationCompletedEvent(aBrowserComponent) and + AddSourceChangedEvent(aBrowserComponent) and + AddHistoryChangedEvent(aBrowserComponent) and + AddContentLoadingEvent(aBrowserComponent) and + AddDocumentTitleChangedEvent(aBrowserComponent) and + AddNewWindowRequestedEvent(aBrowserComponent) and + AddFrameNavigationStartingEvent(aBrowserComponent) and + AddFrameNavigationCompletedEvent(aBrowserComponent) and + AddWebResourceRequestedEvent(aBrowserComponent) and + AddScriptDialogOpeningEvent(aBrowserComponent) and + AddPermissionRequestedEvent(aBrowserComponent) and + AddProcessFailedEvent(aBrowserComponent) and + AddWebMessageReceivedEvent(aBrowserComponent) and + AddContainsFullScreenElementChangedEvent(aBrowserComponent) and + AddWindowCloseRequestedEvent(aBrowserComponent) and + AddWebResourceResponseReceivedEvent(aBrowserComponent) and + AddDOMContentLoadedEvent(aBrowserComponent) and + AddFrameCreatedEvent(aBrowserComponent) and + AddDownloadStartingEvent(aBrowserComponent) and + AddClientCertificateRequestedEvent(aBrowserComponent) and + AddIsMutedChangedEvent(aBrowserComponent) and + AddIsDocumentPlayingAudioChangedEvent(aBrowserComponent) and + AddIsDefaultDownloadDialogOpenChangedEvent(aBrowserComponent); end; function TCoreWebView2.AddWebResourceRequestedFilter(const URI : wvstring; @@ -928,6 +1020,18 @@ function TCoreWebView2.RemoveScriptToExecuteOnDocumentCreated(const aID : wvstri succeeded(FBaseIntf.RemoveScriptToExecuteOnDocumentCreated(PWideChar(aID))); end; +function TCoreWebView2.OpenDefaultDownloadDialog : boolean; +begin + Result := assigned(FBaseIntf9) and + succeeded(FBaseIntf9.OpenDefaultDownloadDialog); +end; + +function TCoreWebView2.CloseDefaultDownloadDialog : boolean; +begin + Result := assigned(FBaseIntf9) and + succeeded(FBaseIntf9.CloseDefaultDownloadDialog); +end; + function TCoreWebView2.GetBrowserProcessID : cardinal; var TempID : DWORD; @@ -1043,4 +1147,71 @@ function TCoreWebView2.GetSettings : ICoreWebView2Settings; Result := TempResult; end; +function TCoreWebView2.GetIsMuted : boolean; +var + TempResult : integer; +begin + Result := assigned(FBaseIntf8) and + succeeded(FBaseIntf8.Get_IsMuted(TempResult)) and + (TempResult <> 0); +end; + +function TCoreWebView2.GetIsDocumentPlayingAudio : boolean; +var + TempResult : integer; +begin + Result := assigned(FBaseIntf8) and + succeeded(FBaseIntf8.Get_IsDocumentPlayingAudio(TempResult)) and + (TempResult <> 0); +end; + +function TCoreWebView2.GetIsDefaultDownloadDialogOpen : boolean; +var + TempResult : integer; +begin + Result := assigned(FBaseIntf9) and + succeeded(FBaseIntf9.Get_IsDefaultDownloadDialogOpen(TempResult)) and + (TempResult <> 0); +end; + +function TCoreWebView2.GetDefaultDownloadDialogCornerAlignment : TWVDefaultDownloadDialogCornerAlignment; +var + TempResult : COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT; +begin + if assigned(FBaseIntf9) and + succeeded(FBaseIntf9.Get_DefaultDownloadDialogCornerAlignment(TempResult)) then + Result := TempResult + else + Result := 0; +end; + +function TCoreWebView2.GetDefaultDownloadDialogMargin : TPoint; +var + TempResult : tagPOINT; +begin + if assigned(FBaseIntf9) and + succeeded(FBaseIntf9.Get_DefaultDownloadDialogMargin(TempResult)) then + Result := TPoint(TempResult) + else + Result := point(0, 0); +end; + +procedure TCoreWebView2.SetIsMuted(aValue : boolean); +begin + if assigned(FBaseIntf8) then + FBaseIntf8.Set_IsMuted(ord(aValue)); +end; + +procedure TCoreWebView2.SetDefaultDownloadDialogCornerAlignment(aValue : TWVDefaultDownloadDialogCornerAlignment); +begin + if assigned(FBaseIntf9) then + FBaseIntf9.Set_DefaultDownloadDialogCornerAlignment(aValue); +end; + +procedure TCoreWebView2.SetDefaultDownloadDialogMargin(aValue : TPoint); +begin + if assigned(FBaseIntf9) then + FBaseIntf9.Set_DefaultDownloadDialogMargin(tagPOINT(aValue)); +end; + end. diff --git a/source/uWVCoreWebView2Delegates.pas b/source/uWVCoreWebView2Delegates.pas index 7eec09b..c4c61a6 100644 --- a/source/uWVCoreWebView2Delegates.pas +++ b/source/uWVCoreWebView2Delegates.pas @@ -551,6 +551,39 @@ TCoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler = class(TInte destructor Destroy; override; end; + TCoreWebView2IsMutedChangedEventHandler = class(TInterfacedObject, ICoreWebView2IsMutedChangedEventHandler) + protected + FEvents : Pointer; + + function Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; + + public + constructor Create(const aEvents: IWVBrowserEvents); reintroduce; + destructor Destroy; override; + end; + + TCoreWebView2IsDocumentPlayingAudioChangedEventHandler = class(TInterfacedObject, ICoreWebView2IsDocumentPlayingAudioChangedEventHandler) + protected + FEvents : Pointer; + + function Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; + + public + constructor Create(const aEvents: IWVBrowserEvents); reintroduce; + destructor Destroy; override; + end; + + TCoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler = class(TInterfacedObject, ICoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler) + protected + FEvents : Pointer; + + function Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; + + public + constructor Create(const aEvents: IWVBrowserEvents); reintroduce; + destructor Destroy; override; + end; + implementation @@ -1774,4 +1807,79 @@ function TCoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler.Invoke end; +// TCoreWebView2IsMutedChangedEventHandler + +constructor TCoreWebView2IsMutedChangedEventHandler.Create(const aEvents: IWVBrowserEvents); +begin + inherited Create; + + FEvents := Pointer(aEvents); +end; + +destructor TCoreWebView2IsMutedChangedEventHandler.Destroy; +begin + FEvents := nil; + + inherited Destroy; +end; + +function TCoreWebView2IsMutedChangedEventHandler.Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; +begin + if (FEvents <> nil) then + Result := IWVBrowserEvents(FEvents).IsMutedChangedEventHandler_Invoke(sender, args) + else + Result := E_FAIL; +end; + + +// TCoreWebView2IsDocumentPlayingAudioChangedEventHandler + +constructor TCoreWebView2IsDocumentPlayingAudioChangedEventHandler.Create(const aEvents: IWVBrowserEvents); +begin + inherited Create; + + FEvents := Pointer(aEvents); +end; + +destructor TCoreWebView2IsDocumentPlayingAudioChangedEventHandler.Destroy; +begin + FEvents := nil; + + inherited Destroy; +end; + +function TCoreWebView2IsDocumentPlayingAudioChangedEventHandler.Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; +begin + if (FEvents <> nil) then + Result := IWVBrowserEvents(FEvents).IsDocumentPlayingAudioChangedEventHandler_Invoke(sender, args) + else + Result := E_FAIL; +end; + + +// TCoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler + +constructor TCoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler.Create(const aEvents: IWVBrowserEvents); +begin + inherited Create; + + FEvents := Pointer(aEvents); +end; + +destructor TCoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler.Destroy; +begin + FEvents := nil; + + inherited Destroy; +end; + +function TCoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler.Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; +begin + if (FEvents <> nil) then + Result := IWVBrowserEvents(FEvents).IsDefaultDownloadDialogOpenChangedEventHandler_Invoke(sender, args) + else + Result := E_FAIL; +end; + + end. diff --git a/source/uWVEvents.pas b/source/uWVEvents.pas index 72b4279..dac0497 100644 --- a/source/uWVEvents.pas +++ b/source/uWVEvents.pas @@ -62,6 +62,9 @@ interface TOnOfflineCompletedEvent = procedure(Sender: TObject; aResult: boolean) of object; TOnIgnoreCertificateErrorsCompletedEvent = procedure(Sender: TObject; aResult: boolean) of object; TOnSimulateKeyEventCompletedEvent = procedure(Sender: TObject; aResult: boolean) of object; + TOnIsMutedChangedEvent = procedure(Sender: TObject; const aWebView: ICoreWebView2) of object; + TOnIsDocumentPlayingAudioChangedEvent = procedure(Sender: TObject; const aWebView: ICoreWebView2) of object; + TOnIsDefaultDownloadDialogOpenChangedEvent = procedure(Sender: TObject; const aWebView: ICoreWebView2) of object; // Custom events TOnCompMsgEvent = procedure(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean) of object; diff --git a/source/uWVInterfaces.pas b/source/uWVInterfaces.pas index 1dc6084..d0048f1 100644 --- a/source/uWVInterfaces.pas +++ b/source/uWVInterfaces.pas @@ -166,6 +166,15 @@ interface // ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler function AddScriptToExecuteOnDocumentCreatedCompletedHandler_Invoke(errorCode: HResult; id: PWideChar): HResult; + + // ICoreWebView2IsMutedChangedEventHandler + function IsMutedChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; + + // ICoreWebView2IsDocumentPlayingAudioChangedEventHandler + function IsDocumentPlayingAudioChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; + + // ICoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler + function IsDefaultDownloadDialogOpenChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; end; implementation diff --git a/source/uWVTypeLibrary.pas b/source/uWVTypeLibrary.pas index 4d04458..4749bce 100644 --- a/source/uWVTypeLibrary.pas +++ b/source/uWVTypeLibrary.pas @@ -28,10 +28,10 @@ // ************************************************************************ // // $Rev: 98336 $ -// File generated on 02/12/2021 11:35:30 from Type Library described below. +// File generated on 11/01/2022 11:26:19 from Type Library described below. // ************************************************************************ // -// Type Lib: Z:\microsoft.web.webview2.1.0.1054.31.nupkg_FILES\WebView2.tlb (1) +// Type Lib: Z:\microsoft.web.webview2.1.0.1072.54.nupkg_FILES\WebView2.tlb (1) // LIBID: {26D34152-879F-4065-BEA2-3DAA2CFADFB8} // LCID: 0 // Helpfile: @@ -160,6 +160,11 @@ interface IID_ICoreWebView2_7: TGUID = '{79C24D83-09A3-45AE-9418-487F32A58740}'; IID_ICoreWebView2PrintSettings: TGUID = '{377F3721-C74E-48CA-8DB1-DF68E51D60E2}'; IID_ICoreWebView2PrintToPdfCompletedHandler: TGUID = '{CCF1EF04-FD8E-4D5F-B2DE-0983E41B8C36}'; + IID_ICoreWebView2_8: TGUID = '{E9632730-6E1E-43AB-B7B8-7B2C9E62E094}'; + IID_ICoreWebView2IsMutedChangedEventHandler: TGUID = '{57D90347-CD0E-4952-A4A2-7483A2756F08}'; + IID_ICoreWebView2IsDocumentPlayingAudioChangedEventHandler: TGUID = '{5DEF109A-2F4B-49FA-B7F6-11C39E513328}'; + IID_ICoreWebView2_9: TGUID = '{4D7B2EAB-9FDC-468D-B998-A9260B5ED651}'; + IID_ICoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler: TGUID = '{3117DA26-AE13-438D-BD46-EDBEB2C4CE81}'; IID_ICoreWebView2BrowserProcessExitedEventArgs: TGUID = '{1F00663F-AF8C-4782-9CDD-DD01C52E34CB}'; IID_ICoreWebView2BrowserProcessExitedEventHandler: TGUID = '{FA504257-A216-4911-A860-FE8825712861}'; IID_ICoreWebView2CompositionController: TGUID = '{3DF9B733-B9AE-4A15-86B4-EB9EE9826469}'; @@ -378,6 +383,15 @@ interface COREWEBVIEW2_PRINT_ORIENTATION_PORTRAIT = $00000000; COREWEBVIEW2_PRINT_ORIENTATION_LANDSCAPE = $00000001; +// Constants for enum COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT +type + COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT = TOleEnum; +const + COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT_TOP_LEFT = $00000000; + COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT_TOP_RIGHT = $00000001; + COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT_BOTTOM_LEFT = $00000002; + COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT_BOTTOM_RIGHT = $00000003; + // Constants for enum COREWEBVIEW2_BROWSER_PROCESS_EXIT_KIND type COREWEBVIEW2_BROWSER_PROCESS_EXIT_KIND = TOleEnum; @@ -538,6 +552,11 @@ interface ICoreWebView2_7 = interface; ICoreWebView2PrintSettings = interface; ICoreWebView2PrintToPdfCompletedHandler = interface; + ICoreWebView2_8 = interface; + ICoreWebView2IsMutedChangedEventHandler = interface; + ICoreWebView2IsDocumentPlayingAudioChangedEventHandler = interface; + ICoreWebView2_9 = interface; + ICoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler = interface; ICoreWebView2BrowserProcessExitedEventArgs = interface; ICoreWebView2BrowserProcessExitedEventHandler = interface; ICoreWebView2CompositionController = interface; @@ -1870,6 +1889,73 @@ COREWEBVIEW2_COLOR = record function Invoke(errorCode: HResult; isSuccessful: Integer): HResult; stdcall; end; +// *********************************************************************// +// Interface: ICoreWebView2_8 +// Flags: (0) +// GUID: {E9632730-6E1E-43AB-B7B8-7B2C9E62E094} +// *********************************************************************// + ICoreWebView2_8 = interface(ICoreWebView2_7) + ['{E9632730-6E1E-43AB-B7B8-7B2C9E62E094}'] + function add_IsMutedChanged(const eventHandler: ICoreWebView2IsMutedChangedEventHandler; + out token: EventRegistrationToken): HResult; stdcall; + function remove_IsMutedChanged(token: EventRegistrationToken): HResult; stdcall; + function Get_IsMuted(out value: Integer): HResult; stdcall; + function Set_IsMuted(value: Integer): HResult; stdcall; + function add_IsDocumentPlayingAudioChanged(const eventHandler: ICoreWebView2IsDocumentPlayingAudioChangedEventHandler; + out token: EventRegistrationToken): HResult; stdcall; + function remove_IsDocumentPlayingAudioChanged(token: EventRegistrationToken): HResult; stdcall; + function Get_IsDocumentPlayingAudio(out value: Integer): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ICoreWebView2IsMutedChangedEventHandler +// Flags: (0) +// GUID: {57D90347-CD0E-4952-A4A2-7483A2756F08} +// *********************************************************************// + ICoreWebView2IsMutedChangedEventHandler = interface(IUnknown) + ['{57D90347-CD0E-4952-A4A2-7483A2756F08}'] + function Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ICoreWebView2IsDocumentPlayingAudioChangedEventHandler +// Flags: (0) +// GUID: {5DEF109A-2F4B-49FA-B7F6-11C39E513328} +// *********************************************************************// + ICoreWebView2IsDocumentPlayingAudioChangedEventHandler = interface(IUnknown) + ['{5DEF109A-2F4B-49FA-B7F6-11C39E513328}'] + function Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ICoreWebView2_9 +// Flags: (0) +// GUID: {4D7B2EAB-9FDC-468D-B998-A9260B5ED651} +// *********************************************************************// + ICoreWebView2_9 = interface(ICoreWebView2_8) + ['{4D7B2EAB-9FDC-468D-B998-A9260B5ED651}'] + function add_IsDefaultDownloadDialogOpenChanged(const handler: ICoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler; + out token: EventRegistrationToken): HResult; stdcall; + function remove_IsDefaultDownloadDialogOpenChanged(token: EventRegistrationToken): HResult; stdcall; + function Get_IsDefaultDownloadDialogOpen(out value: Integer): HResult; stdcall; + function OpenDefaultDownloadDialog: HResult; stdcall; + function CloseDefaultDownloadDialog: HResult; stdcall; + function Get_DefaultDownloadDialogCornerAlignment(out value: COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT): HResult; stdcall; + function Set_DefaultDownloadDialogCornerAlignment(value: COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT): HResult; stdcall; + function Get_DefaultDownloadDialogMargin(out value: tagPOINT): HResult; stdcall; + function Set_DefaultDownloadDialogMargin(value: tagPOINT): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ICoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler +// Flags: (0) +// GUID: {3117DA26-AE13-438D-BD46-EDBEB2C4CE81} +// *********************************************************************// + ICoreWebView2IsDefaultDownloadDialogOpenChangedEventHandler = interface(IUnknown) + ['{3117DA26-AE13-438D-BD46-EDBEB2C4CE81}'] + function Invoke(const sender: ICoreWebView2; const args: IUnknown): HResult; stdcall; + end; + // *********************************************************************// // Interface: ICoreWebView2BrowserProcessExitedEventArgs // Flags: (0) diff --git a/source/uWVTypes.pas b/source/uWVTypes.pas index 250275c..fb7de7f 100644 --- a/source/uWVTypes.pas +++ b/source/uWVTypes.pas @@ -19,28 +19,29 @@ interface wvstring = type string; {$ENDIF} - TWVKeyEventKind = type COREWEBVIEW2_KEY_EVENT_KIND; - TWVMoveFocusReason = type COREWEBVIEW2_MOVE_FOCUS_REASON; - TWVWebErrorStatus = type COREWEBVIEW2_WEB_ERROR_STATUS; - TWVScriptDialogKind = type COREWEBVIEW2_SCRIPT_DIALOG_KIND; - TWVPermissionState = type COREWEBVIEW2_PERMISSION_STATE; - TWVPermissionKind = type COREWEBVIEW2_PERMISSION_KIND; - TWVProcessFailedKind = type COREWEBVIEW2_PROCESS_FAILED_KIND; - TWVCapturePreviewImageFormat = type COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT; - TWVWebResourceContext = type COREWEBVIEW2_WEB_RESOURCE_CONTEXT; - TWVCookieSameSiteKind = type COREWEBVIEW2_COOKIE_SAME_SITE_KIND; - TWVHostResourceAcccessKind = type COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND; - TWVDownloadState = type COREWEBVIEW2_DOWNLOAD_STATE; - TWVDownloadInterruptReason = type COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON; - TWVClientCertificateKind = type COREWEBVIEW2_CLIENT_CERTIFICATE_KIND; - TWVBrowserProcessExitKind = type COREWEBVIEW2_BROWSER_PROCESS_EXIT_KIND; - TWVMouseEventKind = type COREWEBVIEW2_MOUSE_EVENT_KIND; - TWVMouseEventVirtualKeys = type COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS; - TWVPointerEventKind = type COREWEBVIEW2_POINTER_EVENT_KIND; - TWVBoundsMode = type COREWEBVIEW2_BOUNDS_MODE; - TWVProcessFailedReason = type COREWEBVIEW2_PROCESS_FAILED_REASON; - TWVPrintOrientation = type COREWEBVIEW2_PRINT_ORIENTATION; - TWVColor = type COREWEBVIEW2_COLOR; + TWVKeyEventKind = type COREWEBVIEW2_KEY_EVENT_KIND; + TWVMoveFocusReason = type COREWEBVIEW2_MOVE_FOCUS_REASON; + TWVWebErrorStatus = type COREWEBVIEW2_WEB_ERROR_STATUS; + TWVScriptDialogKind = type COREWEBVIEW2_SCRIPT_DIALOG_KIND; + TWVPermissionState = type COREWEBVIEW2_PERMISSION_STATE; + TWVPermissionKind = type COREWEBVIEW2_PERMISSION_KIND; + TWVProcessFailedKind = type COREWEBVIEW2_PROCESS_FAILED_KIND; + TWVCapturePreviewImageFormat = type COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT; + TWVWebResourceContext = type COREWEBVIEW2_WEB_RESOURCE_CONTEXT; + TWVCookieSameSiteKind = type COREWEBVIEW2_COOKIE_SAME_SITE_KIND; + TWVHostResourceAcccessKind = type COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND; + TWVDownloadState = type COREWEBVIEW2_DOWNLOAD_STATE; + TWVDownloadInterruptReason = type COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON; + TWVClientCertificateKind = type COREWEBVIEW2_CLIENT_CERTIFICATE_KIND; + TWVBrowserProcessExitKind = type COREWEBVIEW2_BROWSER_PROCESS_EXIT_KIND; + TWVMouseEventKind = type COREWEBVIEW2_MOUSE_EVENT_KIND; + TWVMouseEventVirtualKeys = type COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS; + TWVPointerEventKind = type COREWEBVIEW2_POINTER_EVENT_KIND; + TWVBoundsMode = type COREWEBVIEW2_BOUNDS_MODE; + TWVProcessFailedReason = type COREWEBVIEW2_PROCESS_FAILED_REASON; + TWVPrintOrientation = type COREWEBVIEW2_PRINT_ORIENTATION; + TWVColor = type COREWEBVIEW2_COLOR; + TWVDefaultDownloadDialogCornerAlignment = type COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT; TWV2LoaderStatus = (wvlsCreated, wvlsLoading, diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index ee09b67..c47b69c 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,9 +2,9 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 21, + "InternalVersion" : 22, "Name" : "webview4delphi.lpk", - "Version" : "1.0.1054.31" + "Version" : "1.0.1072.54" } ], "UpdatePackageData" : {