首次提交:添加src文件夹代码

This commit is contained in:
2026-02-27 14:02:43 +08:00
commit d330cfbca7
4184 changed files with 5546478 additions and 0 deletions

View File

@@ -0,0 +1,201 @@
<?xml version="1.0"?>
<!--
***********************************************************************************************
Copyright (C) Microsoft Corporation. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
***********************************************************************************************
-->
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Only do this for MSBuild versions below 16.0
as it is since done automatically, see https://github.com/microsoft/msbuild/pull/3605
-->
<MSBuildAllProjects Condition="'$(MSBuildToolsVersion)' &lt;= '15'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup>
<WebView2EnablePropertyPage Condition="'$(WebView2EnablePropertyPage)' == '' and '$(WebView2ProjectKind)' == 'native'">true</WebView2EnablePropertyPage>
<WebView2EnablePropertyPage Condition="'$(WebView2EnablePropertyPage)' == '' and '$(VisualStudioVersion)' &gt;= '17.0' and '$(Language)' != 'VB'">true</WebView2EnablePropertyPage>
</PropertyGroup>
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)\WebView2Rules.Project.xml" Condition="'$(WebView2EnablePropertyPage)' == 'true'">
<Context>Project</Context>
</PropertyPageSchema>
</ItemGroup>
<!-- The Platform property is Win32 or x64 for C++ projects. Convert from Win32 to x86 to match our directory structure.
If PlatformTarget property is set, then use that to determine EffectivePlatform for .NET projects.
See conditions: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-conditions?view=vs-2019
and PropertyGroup: https://docs.microsoft.com/en-us/visualstudio/msbuild/propertygroup-element-msbuild?view=vs-2019
-->
<PropertyGroup>
<EffectivePlatform>$(Platform)</EffectivePlatform>
<EffectivePlatform Condition="'$(EffectivePlatform)' == 'Win32'">x86</EffectivePlatform>
<EffectivePlatform Condition="'$(EffectivePlatform)' == 'Any CPU'">x86</EffectivePlatform>
<EffectivePlatform Condition="'$(EffectivePlatform)' == 'AnyCPU'">x86</EffectivePlatform>
<EffectivePlatform Condition="'$(NETCoreSdkRuntimeIdentifier)' == 'win-x86'">x86</EffectivePlatform>
<EffectivePlatform Condition="'$(NETCoreSdkRuntimeIdentifier)' == 'win-x64'">x64</EffectivePlatform>
<EffectivePlatform Condition="'$(PlatformTarget)' == 'x64'">x64</EffectivePlatform>
<EffectivePlatform Condition="'$(PlatformTarget)' == 'x86'">x86</EffectivePlatform>
<EffectivePlatform Condition="'$(PlatformTarget)' == 'Any CPU' And '$(WebView2ProjectKind)' == 'managed'">anycpu</EffectivePlatform>
<EffectivePlatform Condition="'$(PlatformTarget)' == 'AnyCPU' And '$(WebView2ProjectKind)' == 'managed'">anycpu</EffectivePlatform>
<!-- Some .NET projects created from Visual Studio's New Project templates don't always specify PlatformTarget (mostly library projects).
When PlatformTarget isn't specified, the C# compiler (and presumably other .NET compilers) targets AnyCPU by default.
However, without the line below we would end up with an EffectivePlatform of x86.
The result was that the project's output contained an exe targeting AnyCPU, but only an x86 WebView2Loader.dll.
Therefore, trying to run the built project on x64 or ARM64 would fail due to lack of matching WebView2Loader.dll.
The below line fixes that problem by setting EffectivePlatform to AnyCPU if PlatformTarget isn't defined.
I had expected that solution to break C++ projects, however, because I thought that PlatformTarget was only ever used in .NET projects.
That prompted me to add the extra check for WebView2ProjectKind being 'managed', to limit the scope to .NET projects.
Interestingly, testing has determined that the extra check isn't actually necessary.
C++ projects will build successfully without that extra check, so apparently they also define/use PlatformTarget.
I still felt safer leaving the extra check in, though, because it never makes sense for a native project to attempt to target AnyCPU.
For the same reason, I also added the extra check to existing lines above this one which target AnyCPU.
-->
<EffectivePlatform Condition="'$(PlatformTarget)' == '' And '$(WebView2ProjectKind)' == 'managed'">anycpu</EffectivePlatform>
</PropertyGroup>
<!-- Define custom properties to provide the ability to change default WebView2 build behaviors.
See MSBuild properties: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-properties?view=vs-2019
-->
<PropertyGroup>
<!-- For cases where it's non-obvious that we need to expose the WinMD (such as in a C++ non-UAP app) the dev can
set the WebView2UseWinRT property to 'true'.
-->
<WebView2UseWinRT Condition="'$(WebView2UseWinRT)' == '' And '$(TargetPlatformIdentifier)' == 'UAP'">true</WebView2UseWinRT>
<!-- Switch between using a static library or a dll for the WebView2Loader.
'Dynamic' value to use the WebView2Loader.dll, 'Static' value to static lib.
For WinRT, use 'None' and skip copy/link of the loader as it's already linked
to the WebView2 WinRT component.
For wv2winrt, if the project is running the tool, it's either:
1. Using WebView2 WinRT, and does not need the loader
2. Using WebView2 Win32, and needs the loader. Defaulting to include will break case below.
3. Not using WebView2 APIs at all, and doesn't need the loader.
We're choosing the most common scenario from (2), (3) above and defaulting to not including the loader.
-->
<WebView2LoaderPreference Condition="'$(WebView2LoaderPreference)' == '' And ('$(WebView2UseWinRT)' == 'true' Or '$(WebView2UseDispatchAdapter)' == 'true')">None</WebView2LoaderPreference>
<WebView2LoaderPreference Condition="'$(WebView2LoaderPreference)' == ''">Dynamic</WebView2LoaderPreference>
</PropertyGroup>
<Import Project="$(NugetRoot)\build\wv2winrt.targets"/>
<!-- Make our header path available in the include path.
See CL task: https://docs.microsoft.com/en-us/visualstudio/msbuild/cl-task?view=vs-2019
-->
<ItemDefinitionGroup>
<ClCompile>
<!-- MSBuildThisFileDirectory is the path containing this targets file.
See well-known properties: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2019
-->
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<!-- Update link path to include appropriate arch directory and link against our lib.
See Link task: https://docs.microsoft.com/en-us/visualstudio/msbuild/link-task?view=vs-2019
-->
<ItemDefinitionGroup>
<Link Condition="'$(EffectivePlatform)' != 'ARM'">
<WebView2LoaderLib Condition="'$(WebView2LoaderPreference)' == 'Static'">WebView2LoaderStatic.lib;version.lib</WebView2LoaderLib>
<AdditionalDependencies>%(WebView2LoaderLib);WebView2Loader.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)native\$(EffectivePlatform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<!-- Copy DLL to the output path.
Only Copy DLL to the output path when project is C++ and WebView2LoaderPreference is set to Dynamic.
.NET will pick DLL at runtime from runtime folder or processor bit folder base on Core or Framework.
See Content: https://docs.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items?view=vs-2019
See Architecture-specific folders for .NET:
https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks#architecture-specific-folders
-->
<ItemGroup Condition="'$(WebView2LoaderPreference)' == 'Dynamic' And '$(WebView2ProjectKind)' == 'native' And '$(EffectivePlatform)' != 'ARM'">
<Content Include="$(MSBuildThisFileDirectory)native\$(EffectivePlatform)\WebView2Loader.dll">
<Link>%(Filename)%(Extension)</Link>
<PublishState>Included</PublishState>
<Visible>False</Visible>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Pack>false</Pack>
</Content>
</ItemGroup>
<!-- Copy x64, x86 and arm64 WebView2Loader.dlls to sub folders in the output path. For .NET Framework we match
the folder convention used by .NET Core for consistency.
Microsoft.Web.WebView2.Core.dll handles loading the right DLL at runtime for Any CPU under those sub folders.
For SDK style project, check for TargetFramework. For msbuild style, check to make sure project is not C++ and TargetFrameworkVersion equal to v after trimming all numbers and dots.
When using WinRT, the loader is statically linked into the Microsoft.Web.WebView2.Core.dll.
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-target-framework-and-target-platform?view=vs-2019#target-framework-and-profile
-->
<ItemGroup Condition="'$(WebView2ProjectKind)' == 'managed' And '$(WebView2UseWinRT)' != 'true'">
<Content Include="$(MSBuildThisFileDirectory)\..\runtimes\win-x86\native\WebView2Loader.dll" Condition="'$(EffectivePlatform)' == 'x86' Or '$(EffectivePlatform)' == 'anycpu'">
<Link>runtimes\win-x86\native\WebView2Loader.dll</Link>
<PublishState>Included</PublishState>
<Visible>False</Visible>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<IncludeInVsix>true</IncludeInVsix>
<Pack>false</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)\..\runtimes\win-x64\native\WebView2Loader.dll" Condition="'$(EffectivePlatform)' == 'x64' Or '$(EffectivePlatform)' == 'anycpu'">
<Link>runtimes\win-x64\native\WebView2Loader.dll</Link>
<PublishState>Included</PublishState>
<Visible>False</Visible>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<IncludeInVsix>true</IncludeInVsix>
<Pack>false</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)\..\runtimes\win-arm64\native\WebView2Loader.dll" Condition="'$(EffectivePlatform)' == 'arm64' Or '$(EffectivePlatform)' == 'anycpu'">
<Link>runtimes\win-arm64\native\WebView2Loader.dll</Link>
<PublishState>Included</PublishState>
<Visible>False</Visible>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<IncludeInVsix>true</IncludeInVsix>
<Pack>false</Pack>
</Content>
</ItemGroup>
<!-- Setup WinRT DLLs.
See: https://docs.microsoft.com/en-us/nuget/guides/create-uwp-packages
-->
<ItemDefinitionGroup Condition="'$(WebView2UseWinRT)' == 'true'">
<ClCompile>
<!-- MSBuildThisFileDirectory is the path containing this targets file.
See well-known properties: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2019
-->
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include-winrt\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<Choose>
<!-- We are using a Choose/When here instead of a condition directly on the ItemGroup to workaround a VS file inclusion issue that was causing false warnings. -->
<When Condition="'$(WebView2UseWinRT)' == 'true'">
<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\lib\Microsoft.Web.WebView2.Core.winmd" Condition="'$(EffectivePlatform)' != 'ARM'">
<Implementation>Microsoft.Web.WebView2.Core.dll</Implementation>
</Reference>
<Reference Include="$(MSBuildThisFileDirectory)..\lib\Microsoft.Web.WebView2.Core.winmd" Condition="'$(EffectivePlatform)' == 'ARM'">
<!-- We don't support ARM, but to support builds we allow access to the winmd without specifying the implementing dll -->
</Reference>
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\runtimes\win-$(EffectivePlatform)\native_uap\Microsoft.Web.WebView2.Core.dll" Condition="'$(EffectivePlatform)' != 'ARM'"/>
<!-- We limit the SDKReference to 'UAP' because it targets 'UAP' as well, and would conflict if used in an app targeting 'Windows' -->
<SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0" Condition="'$(TargetPlatformIdentifier)' == 'UAP'"/>
</ItemGroup>
</When>
<When Condition="'$(WebView2UseWinRT)' == 'false' and '$(WebView2UseDispatchAdapter)' == 'true'">
<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\lib\Microsoft.Web.WebView2.Core.winmd">
<!-- wv2winrt needs Dispatch Adapter metadata to generate code -->
</Reference>
</ItemGroup>
</When>
</Choose>
<!-- Cleanup our copied files when cleaning.
See Delete: https://docs.microsoft.com/en-us/visualstudio/msbuild/delete-task?view=vs-2019
See AfterTargets: https://docs.microsoft.com/en-us/visualstudio/msbuild/target-build-order?view=vs-2019
-->
<Target Name="CleanDownloadContentFiles" AfterTargets="Clean">
<Delete Files="$(OutputPath)\WebView2Loader.dll"/>
</Target>
</Project>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This build/.targets file is used by managed VS projects including win32
apps and UWP apps. -->
<PropertyGroup>
<WebView2ProjectKind>managed</WebView2ProjectKind>
</PropertyGroup>
<PropertyGroup>
<!-- The managed targets file is under build
so the root is one path segment up. -->
<NugetRoot>$(MSBuildThisFileDirectory)..\</NugetRoot>
</PropertyGroup>
<!-- Example logging
<Target Name="WebView2ManagedEntryLog" BeforeTargets="Build">
<Message Text="WebView2 managed .targets file. $(NugetRoot)" Importance="high"/>
</Target>
-->
<Import Project="$(NugetRoot)\build\Common.targets"/>
</Project>

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<Rule Name="WebView2" DisplayName="WebView2" Order="75" PageTemplate="generic" xmlns="http://schemas.microsoft.com/build/2009/properties">
<Rule.Categories>
<Category Name="General" DisplayName="General" />
<Category Name="wv2winrt" DisplayName="WinRT in Script" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" HasConfigurationCondition="false" Label="Globals" />
</Rule.DataSource>
<BoolProperty Name="WebView2UseWinRT"
DisplayName="Use WebView2 WinRT APIs"
Description="Enables the WebView2 WinRT APIs for this project"
Category="General" />
<EnumProperty Name="WebView2LoaderPreference"
DisplayName="Loader preference"
Description="Switch between using a static library or a DLL for the WebView2Loader"
Category="General">
<EnumValue Name="Dynamic" DisplayName="Dynamic" Description="Sets the project to use a DLL for the WebView2Loader" />
<EnumValue Name="Static" DisplayName="Static" Description="Sets the project to use a static library for the WebView2Loader" />
</EnumProperty>
<BoolProperty Name="WebView2UseDispatchAdapter"
DisplayName="Use the wv2winrt tool"
Description="Uses the wv2winrt tool that allows you to use WinRT objects with CoreWebView2.AddHostObjectToScript."
Category="wv2winrt" />
<StringProperty Name="WebView2DispatchAdapterOutputDir"
DisplayName="Output directory"
Description="Specifies the directory where source files generated by wv2winrt will be saved."
Category="wv2winrt" />
<StringProperty Name="WebView2DispatchAdapterNamespace"
DisplayName="Output namespace"
Description="Namespace where types generated by wv2winrt will be placed."
Category="wv2winrt" />
<BoolProperty Name="WebView2DispatchAdapterUseJavaScriptCase"
DisplayName="Use JavaScript case"
Description="Enables JavaScript casing in wv2winrt generated types"
Category="wv2winrt" />
<EnumProperty Name="WV2WinRTVerbosity"
DisplayName="Verbosity"
Description="Sets the importance of wv2winrt build messages"
Category="wv2winrt">
<EnumValue Name="low" DisplayName="low" Description="Enables messages when MSBuild verbosity is set to at least 'detailed'" />
<EnumValue Name="normal" DisplayName="normal" Description="Enables messages when MSBuild verbosity is set to at least 'normal'" />
<EnumValue Name="high" DisplayName="high" Description="Enables messages when MSBuild verbosity is set to at least 'minimal'" />
</EnumProperty>
<BoolProperty Name="WV2WinRTExplicitIncludesOnly"
DisplayName="Explicit includes only"
Description="Instead of implicitly including types referenced by included types, only types explicitly listed in an include will be included by wv2winrt."
Category="wv2winrt" />
<BoolProperty Name="WV2WinRTRequireAllowForWebAttribute"
DisplayName="AllowForWeb attribute is required"
Description="Only types with the 'AllowForWeb' attribute will be included by wv2winrt."
Category="wv2winrt" />
<BoolProperty Name="WV2WinRTIgnoreWebHostHiddenAttribute"
DisplayName="WebHostHidden attribute is ignored"
Description="Instead of excluding types with the 'WebHostHidden' attribute, ignore the attribute when deciding to include or exclude types."
Category="wv2winrt" />
<BoolProperty Name="WV2WinRTDisallowEmptyAdapter"
DisplayName="Disallow empty adapter"
Description="Enables build error when there are no winmd reference inputs to wv2winrt"
Category="wv2winrt" />
<BoolProperty Name="WV2WinRTWrapWebViewTypes"
DisplayName="Wrap WebView2 types"
Description="Includes WebView2 types in the types generated by wv2winrt"
Category="wv2winrt" />
<BoolProperty Name="WebView2WinRTWrapSystemTypes"
DisplayName="Wrap system types"
Description="Includes WinRT types from the Windows SDK in the types generated by wv2winrt"
Category="wv2winrt" />
<EnumProperty Name="WV2WinRTPlatformReferencesLevel"
DisplayName="Platform references level"
Description="Sets the level of platform references to take as input to wv2winrt. Changes to this property have the most impact for Desktop projects, where the default of matching C++/WinRT can have a dramatic impact on binary size. Setting this property to a value different to the default one may require manually adding references to WebView2WinRTAdditionalWinMDReferences."
Category="wv2winrt">
<EnumValue Name="explicit" DisplayName="Explicit references" Description="Resolves to platform references already resolved by the project. Behavior may vary depending on the project's target platform (UAP/Desktop)." />
<EnumValue Name="foundation" DisplayName="Explicit references + Foundation contracts" Description="Resolves to explicit references + Foundation contracts from the SDK referenced by this project." />
<EnumValue Name="match" DisplayName="Match C++/WinRT" Description="Resolves to the references set by C++/WinRT." />
</EnumProperty>
<StringListProperty Name="WebView2WinRTAdditionalWinMDReferences"
DisplayName="Additional WinMD references"
Description="List of paths to additional WinMD files to provide to wv2winrt"
Category="wv2winrt" />
<StringListProperty Name="WebView2DispatchAdapterIncludeFilters"
DisplayName="Include filters"
Description="List of namespaces or runtimeclass full names used to match types to include from referenced WinMD files"
Category="wv2winrt" />
<StringListProperty Name="WebView2DispatchAdapterExcludeFilters"
DisplayName="Exclude filters"
Description="List of namespaces or runtimeclass full names used to match types to exclude from referenced WinMD files"
Category="wv2winrt" />
</Rule>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This build\native\.targets file is used by native (C++) VS projects including win32 and UWP. -->
<PropertyGroup>
<WebView2ProjectKind>native</WebView2ProjectKind>
</PropertyGroup>
<PropertyGroup>
<!-- The native targets file is under build\native
so the root is two path segments up. -->
<NugetRoot>$(MSBuildThisFileDirectory)..\..\</NugetRoot>
</PropertyGroup>
<!-- Example logging
<Target Name="WebView2NativeEntryLog" BeforeTargets="Build">
<Message Text="WebView2 native .targets file. $(NugetRoot)" Importance="high"/>
</Target>
-->
<Import Project="$(NugetRoot)\build\Common.targets"/>
</Project>

View File

@@ -0,0 +1,546 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.xx.xxxx */
/* at a redacted point in time
*/
/* Compiler settings for ../../edge_embedded_browser/client/win/current/webview2interop.idl:
Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.xx.xxxx
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef __webview2interop_h__
#define __webview2interop_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#ifndef DECLSPEC_XFGVIRT
#if defined(_CONTROL_FLOW_GUARD_XFG)
#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func))
#else
#define DECLSPEC_XFGVIRT(base, func)
#endif
#endif
/* Forward Declarations */
#ifndef __ICoreWebView2Interop_FWD_DEFINED__
#define __ICoreWebView2Interop_FWD_DEFINED__
typedef interface ICoreWebView2Interop ICoreWebView2Interop;
#endif /* __ICoreWebView2Interop_FWD_DEFINED__ */
#ifndef __ICoreWebView2CompositionControllerInterop_FWD_DEFINED__
#define __ICoreWebView2CompositionControllerInterop_FWD_DEFINED__
typedef interface ICoreWebView2CompositionControllerInterop ICoreWebView2CompositionControllerInterop;
#endif /* __ICoreWebView2CompositionControllerInterop_FWD_DEFINED__ */
#ifndef __ICoreWebView2CompositionControllerInterop2_FWD_DEFINED__
#define __ICoreWebView2CompositionControllerInterop2_FWD_DEFINED__
typedef interface ICoreWebView2CompositionControllerInterop2 ICoreWebView2CompositionControllerInterop2;
#endif /* __ICoreWebView2CompositionControllerInterop2_FWD_DEFINED__ */
#ifndef __ICoreWebView2EnvironmentInterop_FWD_DEFINED__
#define __ICoreWebView2EnvironmentInterop_FWD_DEFINED__
typedef interface ICoreWebView2EnvironmentInterop ICoreWebView2EnvironmentInterop;
#endif /* __ICoreWebView2EnvironmentInterop_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __WebView2Interop_LIBRARY_DEFINED__
#define __WebView2Interop_LIBRARY_DEFINED__
/* library WebView2Interop */
/* [version][uuid] */
EXTERN_C const IID LIBID_WebView2Interop;
#ifndef __ICoreWebView2Interop_INTERFACE_DEFINED__
#define __ICoreWebView2Interop_INTERFACE_DEFINED__
/* interface ICoreWebView2Interop */
/* [unique][object][uuid] */
EXTERN_C __declspec(selectany) const IID IID_ICoreWebView2Interop = {0x912b34a7,0xd10b,0x49c4,{0xaf,0x18,0x7c,0xb7,0xe6,0x04,0xe0,0x1a}};
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("912b34a7-d10b-49c4-af18-7cb7e604e01a")
ICoreWebView2Interop : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE AddHostObjectToScript(
/* [in] */ LPCWSTR name,
/* [in] */ VARIANT *object) = 0;
};
#else /* C style interface */
typedef struct ICoreWebView2InteropVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ICoreWebView2Interop * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
ICoreWebView2Interop * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
ICoreWebView2Interop * This);
DECLSPEC_XFGVIRT(ICoreWebView2Interop, AddHostObjectToScript)
HRESULT ( STDMETHODCALLTYPE *AddHostObjectToScript )(
ICoreWebView2Interop * This,
/* [in] */ LPCWSTR name,
/* [in] */ VARIANT *object);
END_INTERFACE
} ICoreWebView2InteropVtbl;
interface ICoreWebView2Interop
{
CONST_VTBL struct ICoreWebView2InteropVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ICoreWebView2Interop_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ICoreWebView2Interop_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ICoreWebView2Interop_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ICoreWebView2Interop_AddHostObjectToScript(This,name,object) \
( (This)->lpVtbl -> AddHostObjectToScript(This,name,object) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ICoreWebView2Interop_INTERFACE_DEFINED__ */
#ifndef __ICoreWebView2CompositionControllerInterop_INTERFACE_DEFINED__
#define __ICoreWebView2CompositionControllerInterop_INTERFACE_DEFINED__
/* interface ICoreWebView2CompositionControllerInterop */
/* [unique][object][uuid] */
EXTERN_C __declspec(selectany) const IID IID_ICoreWebView2CompositionControllerInterop = {0x8e9922ce,0x9c80,0x42e6,{0xba,0xd7,0xfc,0xeb,0xf2,0x91,0xa4,0x95}};
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("8e9922ce-9c80-42e6-bad7-fcebf291a495")
ICoreWebView2CompositionControllerInterop : public IUnknown
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AutomationProvider(
/* [retval][out] */ IUnknown **provider) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RootVisualTarget(
/* [retval][out] */ IUnknown **target) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RootVisualTarget(
/* [in] */ IUnknown *target) = 0;
};
#else /* C style interface */
typedef struct ICoreWebView2CompositionControllerInteropVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ICoreWebView2CompositionControllerInterop * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
ICoreWebView2CompositionControllerInterop * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
ICoreWebView2CompositionControllerInterop * This);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop, get_AutomationProvider)
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AutomationProvider )(
ICoreWebView2CompositionControllerInterop * This,
/* [retval][out] */ IUnknown **provider);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop, get_RootVisualTarget)
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RootVisualTarget )(
ICoreWebView2CompositionControllerInterop * This,
/* [retval][out] */ IUnknown **target);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop, put_RootVisualTarget)
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RootVisualTarget )(
ICoreWebView2CompositionControllerInterop * This,
/* [in] */ IUnknown *target);
END_INTERFACE
} ICoreWebView2CompositionControllerInteropVtbl;
interface ICoreWebView2CompositionControllerInterop
{
CONST_VTBL struct ICoreWebView2CompositionControllerInteropVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ICoreWebView2CompositionControllerInterop_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ICoreWebView2CompositionControllerInterop_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ICoreWebView2CompositionControllerInterop_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ICoreWebView2CompositionControllerInterop_get_AutomationProvider(This,provider) \
( (This)->lpVtbl -> get_AutomationProvider(This,provider) )
#define ICoreWebView2CompositionControllerInterop_get_RootVisualTarget(This,target) \
( (This)->lpVtbl -> get_RootVisualTarget(This,target) )
#define ICoreWebView2CompositionControllerInterop_put_RootVisualTarget(This,target) \
( (This)->lpVtbl -> put_RootVisualTarget(This,target) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ICoreWebView2CompositionControllerInterop_INTERFACE_DEFINED__ */
#ifndef __ICoreWebView2CompositionControllerInterop2_INTERFACE_DEFINED__
#define __ICoreWebView2CompositionControllerInterop2_INTERFACE_DEFINED__
/* interface ICoreWebView2CompositionControllerInterop2 */
/* [unique][object][uuid] */
EXTERN_C __declspec(selectany) const IID IID_ICoreWebView2CompositionControllerInterop2 = {0x6b47bbe1,0x2480,0x4ff8,{0xa5,0xba,0x69,0xc2,0xf0,0xb8,0x68,0xb3}};
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("6b47bbe1-2480-4ff8-a5ba-69c2f0b868b3")
ICoreWebView2CompositionControllerInterop2 : public ICoreWebView2CompositionControllerInterop
{
public:
virtual HRESULT STDMETHODCALLTYPE DragEnter(
/* [in] */ IDataObject *dataObject,
/* [in] */ DWORD keyState,
/* [in] */ POINT point,
/* [retval][out] */ DWORD *effect) = 0;
virtual HRESULT STDMETHODCALLTYPE DragLeave( void) = 0;
virtual HRESULT STDMETHODCALLTYPE DragOver(
/* [in] */ DWORD keyState,
/* [in] */ POINT point,
/* [retval][out] */ DWORD *effect) = 0;
virtual HRESULT STDMETHODCALLTYPE Drop(
/* [in] */ IDataObject *dataObject,
/* [in] */ DWORD keyState,
/* [in] */ POINT point,
/* [retval][out] */ DWORD *effect) = 0;
};
#else /* C style interface */
typedef struct ICoreWebView2CompositionControllerInterop2Vtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ICoreWebView2CompositionControllerInterop2 * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
ICoreWebView2CompositionControllerInterop2 * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
ICoreWebView2CompositionControllerInterop2 * This);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop, get_AutomationProvider)
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AutomationProvider )(
ICoreWebView2CompositionControllerInterop2 * This,
/* [retval][out] */ IUnknown **provider);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop, get_RootVisualTarget)
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RootVisualTarget )(
ICoreWebView2CompositionControllerInterop2 * This,
/* [retval][out] */ IUnknown **target);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop, put_RootVisualTarget)
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RootVisualTarget )(
ICoreWebView2CompositionControllerInterop2 * This,
/* [in] */ IUnknown *target);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop2, DragEnter)
HRESULT ( STDMETHODCALLTYPE *DragEnter )(
ICoreWebView2CompositionControllerInterop2 * This,
/* [in] */ IDataObject *dataObject,
/* [in] */ DWORD keyState,
/* [in] */ POINT point,
/* [retval][out] */ DWORD *effect);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop2, DragLeave)
HRESULT ( STDMETHODCALLTYPE *DragLeave )(
ICoreWebView2CompositionControllerInterop2 * This);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop2, DragOver)
HRESULT ( STDMETHODCALLTYPE *DragOver )(
ICoreWebView2CompositionControllerInterop2 * This,
/* [in] */ DWORD keyState,
/* [in] */ POINT point,
/* [retval][out] */ DWORD *effect);
DECLSPEC_XFGVIRT(ICoreWebView2CompositionControllerInterop2, Drop)
HRESULT ( STDMETHODCALLTYPE *Drop )(
ICoreWebView2CompositionControllerInterop2 * This,
/* [in] */ IDataObject *dataObject,
/* [in] */ DWORD keyState,
/* [in] */ POINT point,
/* [retval][out] */ DWORD *effect);
END_INTERFACE
} ICoreWebView2CompositionControllerInterop2Vtbl;
interface ICoreWebView2CompositionControllerInterop2
{
CONST_VTBL struct ICoreWebView2CompositionControllerInterop2Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ICoreWebView2CompositionControllerInterop2_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ICoreWebView2CompositionControllerInterop2_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ICoreWebView2CompositionControllerInterop2_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ICoreWebView2CompositionControllerInterop2_get_AutomationProvider(This,provider) \
( (This)->lpVtbl -> get_AutomationProvider(This,provider) )
#define ICoreWebView2CompositionControllerInterop2_get_RootVisualTarget(This,target) \
( (This)->lpVtbl -> get_RootVisualTarget(This,target) )
#define ICoreWebView2CompositionControllerInterop2_put_RootVisualTarget(This,target) \
( (This)->lpVtbl -> put_RootVisualTarget(This,target) )
#define ICoreWebView2CompositionControllerInterop2_DragEnter(This,dataObject,keyState,point,effect) \
( (This)->lpVtbl -> DragEnter(This,dataObject,keyState,point,effect) )
#define ICoreWebView2CompositionControllerInterop2_DragLeave(This) \
( (This)->lpVtbl -> DragLeave(This) )
#define ICoreWebView2CompositionControllerInterop2_DragOver(This,keyState,point,effect) \
( (This)->lpVtbl -> DragOver(This,keyState,point,effect) )
#define ICoreWebView2CompositionControllerInterop2_Drop(This,dataObject,keyState,point,effect) \
( (This)->lpVtbl -> Drop(This,dataObject,keyState,point,effect) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ICoreWebView2CompositionControllerInterop2_INTERFACE_DEFINED__ */
#ifndef __ICoreWebView2EnvironmentInterop_INTERFACE_DEFINED__
#define __ICoreWebView2EnvironmentInterop_INTERFACE_DEFINED__
/* interface ICoreWebView2EnvironmentInterop */
/* [unique][object][uuid] */
EXTERN_C __declspec(selectany) const IID IID_ICoreWebView2EnvironmentInterop = {0xee503a63,0xc1e2,0x4fbf,{0x8a,0x4d,0x82,0x4e,0x95,0xf8,0xbb,0x13}};
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("ee503a63-c1e2-4fbf-8a4d-824e95f8bb13")
ICoreWebView2EnvironmentInterop : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAutomationProviderForWindow(
/* [in] */ HWND hwnd,
/* [retval][out] */ IUnknown **provider) = 0;
};
#else /* C style interface */
typedef struct ICoreWebView2EnvironmentInteropVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ICoreWebView2EnvironmentInterop * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
ICoreWebView2EnvironmentInterop * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
ICoreWebView2EnvironmentInterop * This);
DECLSPEC_XFGVIRT(ICoreWebView2EnvironmentInterop, GetAutomationProviderForWindow)
HRESULT ( STDMETHODCALLTYPE *GetAutomationProviderForWindow )(
ICoreWebView2EnvironmentInterop * This,
/* [in] */ HWND hwnd,
/* [retval][out] */ IUnknown **provider);
END_INTERFACE
} ICoreWebView2EnvironmentInteropVtbl;
interface ICoreWebView2EnvironmentInterop
{
CONST_VTBL struct ICoreWebView2EnvironmentInteropVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ICoreWebView2EnvironmentInterop_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ICoreWebView2EnvironmentInterop_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ICoreWebView2EnvironmentInterop_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ICoreWebView2EnvironmentInterop_GetAutomationProviderForWindow(This,hwnd,provider) \
( (This)->lpVtbl -> GetAutomationProviderForWindow(This,hwnd,provider) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ICoreWebView2EnvironmentInterop_INTERFACE_DEFINED__ */
#endif /* __WebView2Interop_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,142 @@
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import "oaidl.idl";
[uuid(79b85709-2a19-4645-9722-3cc51b86eda7), version(1.0)]
library WebView2Interop {
// Forward declarations
interface ICoreWebView2Interop;
interface ICoreWebView2CompositionControllerInterop;
interface ICoreWebView2CompositionControllerInterop2;
// Enums and structs
// End of enums and structs
/// Interop interface for the CoreWebView2 WinRT object to allow WinRT end
/// developers to be able to use COM interfaces as parameters for some methods.
/// This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2
/// runtime class.
[uuid(912b34a7-d10b-49c4-af18-7cb7e604e01a), object, pointer_default(unique)]
interface ICoreWebView2Interop : IUnknown {
/// Add the provided host object to script running in the WebView with the
/// specified name.
/// See the documentation for ICoreWebView2::AddHostObjectToScript for more
/// information.
HRESULT AddHostObjectToScript([in] LPCWSTR name, [in] VARIANT* object);
}
/// Interop interface for the CoreWebView2CompositionController WinRT object to
/// allow WinRT end developers to be able to use the COM interfaces as parameters
/// for some methods.
/// This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2CompositionController
/// runtime class.
[uuid(8e9922ce-9c80-42e6-bad7-fcebf291a495), object, pointer_default(unique)]
interface ICoreWebView2CompositionControllerInterop : IUnknown {
/// Returns the UI Automation Provider for the WebView. See the documentation for
/// ICoreWebView2CompositionController::AutomationProvider for more information.
[propget] HRESULT AutomationProvider([out, retval] IUnknown** provider);
/// The RootVisualTarget is a visual in the hosting app's visual tree. This
/// visual is where the WebView2 will connect its visual tree.
/// See the documentation for ICoreWebView2CompositionController::RootVisualTarget
/// for more information.
[propget] HRESULT RootVisualTarget([out, retval] IUnknown** target);
/// Set the RootVisualTarget property.
[propput] HRESULT RootVisualTarget([in] IUnknown* target);
}
/// This interface is the continuation of the
/// ICoreWebView2CompositionControllerInterop interface to manage drag and drop.
[uuid(6b47bbe1-2480-4ff8-a5ba-69c2f0b868b3), object, pointer_default(unique)]
interface ICoreWebView2CompositionControllerInterop2 : ICoreWebView2CompositionControllerInterop {
/// This function corresponds to [IDropTarget::DragEnter](/windows/win32/api/oleidl/nf-oleidl-idroptarget-dragenter).
///
/// This function has a dependency on AllowExternalDrop property of
/// CoreWebView2Controller and return E_FAIL to callers to indicate this
/// operation is not allowed if AllowExternalDrop property is set to false.
///
/// The hosting application must register as an IDropTarget and implement
/// and forward DragEnter calls to this function.
///
/// point parameter must be modified to include the WebView's offset and be in
/// the WebView's client coordinates (Similar to how SendMouseInput works).
///
/// \snippet DropTarget.cpp DragEnter
HRESULT DragEnter(
[in] IDataObject* dataObject,
[in] DWORD keyState,
[in] POINT point,
[out, retval] DWORD* effect);
/// This function corresponds to [IDropTarget::DragLeave](/windows/win32/api/oleidl/nf-oleidl-idroptarget-dragleave).
///
/// This function has a dependency on AllowExternalDrop property of
/// CoreWebView2Controller and return E_FAIL to callers to indicate this
/// operation is not allowed if AllowExternalDrop property is set to false.
///
/// The hosting application must register as an IDropTarget and implement
/// and forward DragLeave calls to this function.
///
/// \snippet DropTarget.cpp DragLeave
HRESULT DragLeave();
/// This function corresponds to [IDropTarget::DragOver](/windows/win32/api/oleidl/nf-oleidl-idroptarget-dragover).
///
/// This function has a dependency on AllowExternalDrop property of
/// CoreWebView2Controller and return E_FAIL to callers to indicate this
/// operation is not allowed if AllowExternalDrop property is set to false.
///
/// The hosting application must register as an IDropTarget and implement
/// and forward DragOver calls to this function.
///
/// point parameter must be modified to include the WebView's offset and be in
/// the WebView's client coordinates (Similar to how SendMouseInput works).
///
/// \snippet DropTarget.cpp DragOver
HRESULT DragOver(
[in] DWORD keyState,
[in] POINT point,
[out, retval] DWORD* effect);
/// This function corresponds to [IDropTarget::Drop](/windows/win32/api/oleidl/nf-oleidl-idroptarget-drop).
///
/// This function has a dependency on AllowExternalDrop property of
/// CoreWebView2Controller and return E_FAIL to callers to indicate this
/// operation is not allowed if AllowExternalDrop property is set to false.
///
/// The hosting application must register as an IDropTarget and implement
/// and forward Drop calls to this function.
///
/// point parameter must be modified to include the WebView's offset and be in
/// the WebView's client coordinates (Similar to how SendMouseInput works).
///
/// \snippet DropTarget.cpp Drop
HRESULT Drop(
[in] IDataObject* dataObject,
[in] DWORD keyState,
[in] POINT point,
[out, retval] DWORD* effect);
}
/// Interop interface for the CoreWebView2Environment WinRT object to allow
/// WinRT end developers to be able to use COM interfaces as parameters for some
/// methods.
/// This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2Environment
/// runtime class.
[uuid(ee503a63-c1e2-4fbf-8a4d-824e95f8bb13), object, pointer_default(unique)]
interface ICoreWebView2EnvironmentInterop : IUnknown {
/// Returns the UI Automation Provider for the
/// ICoreWebView2CompositionController that corresponds with the given HWND.
/// See the documentation for ICoreWebView2Environment::GetAutomationProviderForWindow
/// for more information.
HRESULT GetAutomationProviderForWindow([in] HWND hwnd,
[out, retval] IUnknown** provider);
}
// End of interfaces
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,406 @@
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef __core_webview2_environment_options_h__
#define __core_webview2_environment_options_h__
#include <objbase.h>
#include <wrl/implements.h>
#include "webview2.h"
#define CORE_WEBVIEW_TARGET_PRODUCT_VERSION L"126.0.2592.51"
#define COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(p) \
public: \
HRESULT STDMETHODCALLTYPE get_##p(LPWSTR* value) override { \
if (!value) \
return E_POINTER; \
*value = m_##p.Copy(); \
if ((*value == nullptr) && (m_##p.Get() != nullptr)) \
return HRESULT_FROM_WIN32(GetLastError()); \
return S_OK; \
} \
HRESULT STDMETHODCALLTYPE put_##p(LPCWSTR value) override { \
LPCWSTR result = m_##p.Set(value); \
if ((result == nullptr) && (value != nullptr)) \
return HRESULT_FROM_WIN32(GetLastError()); \
return S_OK; \
} \
\
protected: \
AutoCoMemString m_##p;
#define COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(p, defPVal) \
public: \
HRESULT STDMETHODCALLTYPE get_##p(BOOL* value) override { \
if (!value) \
return E_POINTER; \
*value = m_##p; \
return S_OK; \
} \
HRESULT STDMETHODCALLTYPE put_##p(BOOL value) override { \
m_##p = value; \
return S_OK; \
} \
\
protected: \
BOOL m_##p = defPVal ? TRUE : FALSE;
#define DEFINE_AUTO_COMEM_STRING() \
protected: \
class AutoCoMemString { \
public: \
AutoCoMemString() {} \
~AutoCoMemString() { Release(); } \
void Release() { \
if (m_string) { \
deallocate_fn(m_string); \
m_string = nullptr; \
} \
} \
\
LPCWSTR Set(LPCWSTR str) { \
Release(); \
if (str) { \
m_string = MakeCoMemString(str); \
} \
return m_string; \
} \
LPCWSTR Get() { return m_string; } \
LPWSTR Copy() { \
if (m_string) \
return MakeCoMemString(m_string); \
return nullptr; \
} \
\
protected: \
LPWSTR MakeCoMemString(LPCWSTR source) { \
const size_t length = wcslen(source); \
const size_t bytes = (length + 1) * sizeof(*source); \
\
if (bytes <= length) { \
return nullptr; \
} \
\
wchar_t* result = reinterpret_cast<wchar_t*>(allocate_fn(bytes)); \
\
if (result) \
memcpy(result, source, bytes); \
return result; \
} \
LPWSTR m_string = nullptr; \
};
template <typename allocate_fn_t,
allocate_fn_t allocate_fn,
typename deallocate_fn_t,
deallocate_fn_t deallocate_fn>
class CoreWebView2CustomSchemeRegistrationBase
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
ICoreWebView2CustomSchemeRegistration> {
public:
CoreWebView2CustomSchemeRegistrationBase(LPCWSTR schemeName) {
m_schemeName.Set(schemeName);
}
CoreWebView2CustomSchemeRegistrationBase(
CoreWebView2CustomSchemeRegistrationBase&&) = default;
~CoreWebView2CustomSchemeRegistrationBase() { ReleaseAllowedOrigins(); }
HRESULT STDMETHODCALLTYPE get_SchemeName(LPWSTR* schemeName) override {
if (!schemeName)
return E_POINTER;
*schemeName = m_schemeName.Copy();
if ((*schemeName == nullptr) && (m_schemeName.Get() != nullptr))
return HRESULT_FROM_WIN32(GetLastError());
return S_OK;
}
HRESULT STDMETHODCALLTYPE
GetAllowedOrigins(UINT32* allowedOriginsCount,
LPWSTR** allowedOrigins) override {
if (!allowedOrigins || !allowedOriginsCount) {
return E_POINTER;
}
*allowedOriginsCount = 0;
if (m_allowedOriginsCount == 0) {
*allowedOrigins = nullptr;
return S_OK;
} else {
*allowedOrigins = reinterpret_cast<LPWSTR*>(
allocate_fn(m_allowedOriginsCount * sizeof(LPWSTR)));
if (!(*allowedOrigins)) {
return HRESULT_FROM_WIN32(GetLastError());
}
ZeroMemory(*allowedOrigins, m_allowedOriginsCount * sizeof(LPWSTR));
for (UINT32 i = 0; i < m_allowedOriginsCount; i++) {
(*allowedOrigins)[i] = m_allowedOrigins[i].Copy();
if (!(*allowedOrigins)[i]) {
HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
for (UINT32 j = 0; j < i; j++) {
deallocate_fn((*allowedOrigins)[j]);
}
deallocate_fn(*allowedOrigins);
return hr;
}
}
*allowedOriginsCount = m_allowedOriginsCount;
return S_OK;
}
}
HRESULT STDMETHODCALLTYPE
SetAllowedOrigins(UINT32 allowedOriginsCount,
LPCWSTR* allowedOrigins) override {
ReleaseAllowedOrigins();
if (allowedOriginsCount == 0) {
return S_OK;
} else {
m_allowedOrigins = new AutoCoMemString[allowedOriginsCount];
if (!m_allowedOrigins) {
return HRESULT_FROM_WIN32(GetLastError());
}
for (UINT32 i = 0; i < allowedOriginsCount; i++) {
m_allowedOrigins[i].Set(allowedOrigins[i]);
if (!m_allowedOrigins[i].Get()) {
HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
for (UINT32 j = 0; j < i; j++) {
m_allowedOrigins[j].Release();
}
m_allowedOriginsCount = 0;
delete[] (m_allowedOrigins);
return hr;
}
}
m_allowedOriginsCount = allowedOriginsCount;
return S_OK;
}
}
protected:
DEFINE_AUTO_COMEM_STRING();
void ReleaseAllowedOrigins() {
if (m_allowedOrigins) {
delete[] (m_allowedOrigins);
m_allowedOrigins = nullptr;
}
}
AutoCoMemString m_schemeName;
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(TreatAsSecure, false);
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(HasAuthorityComponent, false);
AutoCoMemString* m_allowedOrigins = nullptr;
unsigned int m_allowedOriginsCount = 0;
};
// This is a base COM class that implements ICoreWebView2EnvironmentOptions.
template <typename allocate_fn_t,
allocate_fn_t allocate_fn,
typename deallocate_fn_t,
deallocate_fn_t deallocate_fn>
class CoreWebView2EnvironmentOptionsBase
: public Microsoft::WRL::Implements<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
ICoreWebView2EnvironmentOptions,
ICoreWebView2EnvironmentOptions2,
ICoreWebView2EnvironmentOptions3,
ICoreWebView2EnvironmentOptions4,
ICoreWebView2EnvironmentOptions5,
ICoreWebView2EnvironmentOptions6,
ICoreWebView2EnvironmentOptions7,
ICoreWebView2EnvironmentOptions8> {
public:
static const COREWEBVIEW2_RELEASE_CHANNELS kInternalChannel =
static_cast<COREWEBVIEW2_RELEASE_CHANNELS>(1 << 4);
static const COREWEBVIEW2_RELEASE_CHANNELS kAllChannels =
COREWEBVIEW2_RELEASE_CHANNELS_STABLE |
COREWEBVIEW2_RELEASE_CHANNELS_BETA | COREWEBVIEW2_RELEASE_CHANNELS_DEV |
COREWEBVIEW2_RELEASE_CHANNELS_CANARY | kInternalChannel;
CoreWebView2EnvironmentOptionsBase() {
// Initialize the target compatible browser version value to the version
// of the browser binaries corresponding to this version of the SDK.
m_TargetCompatibleBrowserVersion.Set(CORE_WEBVIEW_TARGET_PRODUCT_VERSION);
}
// ICoreWebView2EnvironmentOptions7
HRESULT STDMETHODCALLTYPE
get_ReleaseChannels(COREWEBVIEW2_RELEASE_CHANNELS* channels) override {
if (!channels) {
return E_POINTER;
}
*channels = m_releaseChannels;
return S_OK;
}
HRESULT STDMETHODCALLTYPE
put_ReleaseChannels(COREWEBVIEW2_RELEASE_CHANNELS channels) override {
m_releaseChannels = channels;
return S_OK;
}
HRESULT STDMETHODCALLTYPE
get_ChannelSearchKind(COREWEBVIEW2_CHANNEL_SEARCH_KIND* value) override {
if (!value) {
return E_POINTER;
}
*value = m_channelSearchKind;
return S_OK;
}
HRESULT STDMETHODCALLTYPE
put_ChannelSearchKind(COREWEBVIEW2_CHANNEL_SEARCH_KIND value) override {
m_channelSearchKind = value;
return S_OK;
}
// ICoreWebView2EnvironmentOptions8
HRESULT STDMETHODCALLTYPE
get_ScrollBarStyle(COREWEBVIEW2_SCROLLBAR_STYLE* style) override {
if (!style) {
return E_POINTER;
}
*style = m_scrollbarStyle;
return S_OK;
}
HRESULT STDMETHODCALLTYPE
put_ScrollBarStyle(COREWEBVIEW2_SCROLLBAR_STYLE style) override {
m_scrollbarStyle = style;
return S_OK;
}
protected:
~CoreWebView2EnvironmentOptionsBase() { ReleaseCustomSchemeRegistrations(); };
void ReleaseCustomSchemeRegistrations() {
if (m_customSchemeRegistrations) {
for (UINT32 i = 0; i < m_customSchemeRegistrationsCount; i++) {
m_customSchemeRegistrations[i]->Release();
}
deallocate_fn(m_customSchemeRegistrations);
m_customSchemeRegistrations = nullptr;
m_customSchemeRegistrationsCount = 0;
}
}
private:
ICoreWebView2CustomSchemeRegistration** m_customSchemeRegistrations = nullptr;
unsigned int m_customSchemeRegistrationsCount = 0;
COREWEBVIEW2_RELEASE_CHANNELS m_releaseChannels = kAllChannels;
COREWEBVIEW2_CHANNEL_SEARCH_KIND m_channelSearchKind =
COREWEBVIEW2_CHANNEL_SEARCH_KIND_MOST_STABLE;
// ICoreWebView2EnvironmentOptions8
COREWEBVIEW2_SCROLLBAR_STYLE m_scrollbarStyle =
COREWEBVIEW2_SCROLLBAR_STYLE_DEFAULT;
DEFINE_AUTO_COMEM_STRING();
public:
// ICoreWebView2EnvironmentOptions
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(AdditionalBrowserArguments)
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(Language)
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(TargetCompatibleBrowserVersion)
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(
AllowSingleSignOnUsingOSPrimaryAccount,
false)
// ICoreWebView2EnvironmentOptions2
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(ExclusiveUserDataFolderAccess,
false)
// ICoreWebView2EnvironmentOptions3
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(IsCustomCrashReportingEnabled,
false)
// ICoreWebView2EnvironmentOptions4
public:
HRESULT STDMETHODCALLTYPE GetCustomSchemeRegistrations(
UINT32* count,
ICoreWebView2CustomSchemeRegistration*** schemeRegistrations) override {
if (!count || !schemeRegistrations) {
return E_POINTER;
}
*count = 0;
if (m_customSchemeRegistrationsCount == 0) {
*schemeRegistrations = nullptr;
return S_OK;
} else {
*schemeRegistrations =
reinterpret_cast<ICoreWebView2CustomSchemeRegistration**>(
allocate_fn(sizeof(ICoreWebView2CustomSchemeRegistration*) *
m_customSchemeRegistrationsCount));
if (!*schemeRegistrations) {
return HRESULT_FROM_WIN32(GetLastError());
}
for (UINT32 i = 0; i < m_customSchemeRegistrationsCount; i++) {
(*schemeRegistrations)[i] = m_customSchemeRegistrations[i];
(*schemeRegistrations)[i]->AddRef();
}
*count = m_customSchemeRegistrationsCount;
return S_OK;
}
}
HRESULT STDMETHODCALLTYPE SetCustomSchemeRegistrations(
UINT32 count,
ICoreWebView2CustomSchemeRegistration** schemeRegistrations) override {
ReleaseCustomSchemeRegistrations();
m_customSchemeRegistrations =
reinterpret_cast<ICoreWebView2CustomSchemeRegistration**>(allocate_fn(
sizeof(ICoreWebView2CustomSchemeRegistration*) * count));
if (!m_customSchemeRegistrations) {
return GetLastError();
}
for (UINT32 i = 0; i < count; i++) {
m_customSchemeRegistrations[i] = schemeRegistrations[i];
m_customSchemeRegistrations[i]->AddRef();
}
m_customSchemeRegistrationsCount = count;
return S_OK;
}
// ICoreWebView2EnvironmentOptions5
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(EnableTrackingPrevention, true)
// ICoreWebView2EnvironmentOptions6
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(AreBrowserExtensionsEnabled,
false)
};
template <typename allocate_fn_t,
allocate_fn_t allocate_fn,
typename deallocate_fn_t,
deallocate_fn_t deallocate_fn>
class CoreWebView2EnvironmentOptionsBaseClass
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
CoreWebView2EnvironmentOptionsBase<allocate_fn_t,
allocate_fn,
deallocate_fn_t,
deallocate_fn>> {
public:
CoreWebView2EnvironmentOptionsBaseClass() {}
protected:
~CoreWebView2EnvironmentOptionsBaseClass() override {}
};
typedef CoreWebView2CustomSchemeRegistrationBase<decltype(&::CoTaskMemAlloc),
::CoTaskMemAlloc,
decltype(&::CoTaskMemFree),
::CoTaskMemFree>
CoreWebView2CustomSchemeRegistration;
typedef CoreWebView2EnvironmentOptionsBaseClass<decltype(&::CoTaskMemAlloc),
::CoTaskMemAlloc,
decltype(&::CoTaskMemFree),
::CoTaskMemFree>
CoreWebView2EnvironmentOptions;
#endif // __core_webview2_environment_options_h__

View File

@@ -0,0 +1,253 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
***********************************************************************************************
Copyright (C) Microsoft Corporation. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
***********************************************************************************************
-->
<!-- This file contains the targets properties and such related to the wv2winrt tool.
It depends on the following from the importer:
* To guarantee that the wv2winrt tool is available at path ..\tools\wv2winrt\ (overridable via WV2WinRTPath, which must end with a single trailing slash `\`); or that WV2WinRTExe is defined with a valid path.
* To guarantee that Microsoft.Web.WebView2.winmd is referenced by the project when the tool is enabled (as defined by WebView2UseDispatchAdapter).
* To guarantee that, if defined, GeneratedFilesDir ends with a single trailing slash `\`; or to define WebView2DispatchAdapterOutputDir ending with a single trailing slash '\'.
-->
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Only do this for MSBuild versions below 16.0
as it is since done automatically, see https://github.com/microsoft/msbuild/pull/3605
-->
<MSBuildAllProjects Condition="'$(MSBuildToolsVersion)' &lt;= '15'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup>
<GeneratedFilesDir Condition="'$(GeneratedFilesDir)' == ''">$(IntDir)Generated Files\</GeneratedFilesDir>
<WV2WinRTVerbosity Condition="'$(WV2WinRTVerbosity)' == ''">normal</WV2WinRTVerbosity>
<WV2WinRTPath Condition="'$(WV2WinRTPath)' == ''">$(MSBuildThisFileDirectory)..\tools\wv2winrt\</WV2WinRTPath>
<WV2WinRTExe Condition="'$(WV2WinRTExe)' == ''">$(WV2WinRTPath)wv2winrt.exe</WV2WinRTExe>
<WV2WinRTWinMDInputsResponseFile Condition="'$(WV2WinRTWinMDInputsResponseFile)' == ''">$(IntDir)wv2winrt_inputs.rsp</WV2WinRTWinMDInputsResponseFile>
<WV2WinRTParametersResponseFile Condition="'$(WV2WinRTParametersResponseFile)' == ''">$(IntDir)wv2winrt_params.rsp</WV2WinRTParametersResponseFile>
<WV2WinRTSkipMakeProjections Condition="'$(WV2WinRTSkipMakeProjections)' == ''">false</WV2WinRTSkipMakeProjections>
<WV2WinRTRequireAllowForWebAttribute Condition="'$(WV2WinRTRequireAllowForWebAttribute)' == ''">false</WV2WinRTRequireAllowForWebAttribute>
<WV2WinRTIgnoreWebHostHiddenAttribute Condition="'$(WV2WinRTIgnoreWebHostHiddenAttribute)' == ''">false</WV2WinRTIgnoreWebHostHiddenAttribute>
<!-- If WebView2UseWinRT is enabled, we assume the generated classes are being used in this project and put them under wv2winrt default namespace. -->
<WebView2DispatchAdapterNamespace Condition="'$(WebView2DispatchAdapterNamespace)' == '' and '$(WebView2UseWinRT)' == 'true'">WinRTAdapter</WebView2DispatchAdapterNamespace>
<!-- Otherwise, we assume the project will be consumed from a separate project. We put generated code under RootNamespace in this case as that's the namespace that will be automatically available when the project is referenced. -->
<WebView2DispatchAdapterNamespace Condition="'$(WebView2DispatchAdapterNamespace)' == ''">$(RootNamespace)</WebView2DispatchAdapterNamespace>
<WebView2DispatchAdapterOutputDir Condition="'$(WebView2DispatchAdapterOutputDir)' == ''">$(GeneratedFilesDir)</WebView2DispatchAdapterOutputDir>
<WV2WinRTDisallowEmptyAdapter Condition="'$(WV2WinRTDisallowEmptyAdapter)' == ''">true</WV2WinRTDisallowEmptyAdapter>
<WebView2WinRTWrapSystemTypes Condition="'$(WebView2WinRTWrapSystemTypes)' == ''">true</WebView2WinRTWrapSystemTypes>
<WV2WinRTPlatformReferencesLevel Condition="'$(WV2WinRTPlatformReferencesLevel)' == ''">match</WV2WinRTPlatformReferencesLevel>
<!-- Note: Before* targets run before Compute* targets. -->
<BeforeMidlCompileTargets Condition="'$(WebView2UseDispatchAdapter)' == 'true'">
$(BeforeMidlCompileTargets);WV2WinRTAddDispatchAdapterIdl;
</BeforeMidlCompileTargets>
<BeforeClCompileTargets Condition="'$(WebView2UseDispatchAdapter)' == 'true'">
$(BeforeClCompileTargets);WV2WinRTAddGeneratedFiles;
</BeforeClCompileTargets>
</PropertyGroup>
<Target Name="GetWV2WinRTPlatformWinMDReferences"
DependsOnTargets="ResolveAssemblyReferences;CppWinRTImplicitlyExpandTargetPlatform;GetCppWinRTPlatformWinMDReferences;$(GetWV2WinRTPlatformWinMDReferencesDependsOn)"
Returns="@(WV2WinRTPlatformWinMDReferences)">
<ItemGroup>
<_WV2WinRTPlatformWinMDReferences Remove="@(_WV2WinRTPlatformWinMDReferences)"/>
<!-- Project platform references -->
<_WV2WinRTPlatformWinMDReferences Include="@(ReferencePath)" Condition="('$(WV2WinRTPlatformReferencesLevel)' == 'explicit' or '$(WV2WinRTPlatformReferencesLevel)' == 'foundation') and '%(ReferencePath.IsSystemReference)' == 'true' and '%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ReferenceSourceTarget)' == 'ResolveAssemblyReference'"/>
<!-- Foundation contracts -->
<_WV2WinRTPlatformWinMDReferences Include="$(WindowsSDK_MetadataPathVersioned)\**\Windows.Foundation.FoundationContract.winmd" Condition="'$(WV2WinRTPlatformReferencesLevel)' == 'foundation'"/>
<_WV2WinRTPlatformWinMDReferences Include="$(WindowsSDK_MetadataPathVersioned)\**\Windows.Foundation.UniversalApiContract.winmd" Condition="'$(WV2WinRTPlatformReferencesLevel)' == 'foundation'"/>
<_WV2WinRTPlatformWinMDReferences Include="$(WindowsSDK_MetadataPathVersioned)\**\Windows.Networking.Connectivity.WwanContract.winmd" Condition="'$(WV2WinRTPlatformReferencesLevel)' == 'foundation'"/>
<!-- C++/WinRT -->
<_WV2WinRTPlatformWinMDReferences Include="@(CppWinRTPlatformWinMDReferences)" Condition="'$(WV2WinRTPlatformReferencesLevel)' == 'match'"/>
<WV2WinRTPlatformWinMDReferences Remove="@(WV2WinRTPlatformWinMDReferences)"/>
<WV2WinRTPlatformWinMDReferences Include="@(_WV2WinRTPlatformWinMDReferences->'%(FullPath)'->Distinct())"/>
</ItemGroup>
<Message Text="WV2WinRTPlatformWinMDReferences: &#xA;@(WV2WinRTPlatformWinMDReferences->'%(FullPath)', '&#xA;')" Importance="$(WV2WinRTVerbosity)"/>
</Target>
<Target Name="GetWV2WinRTDirectWinMDReferences"
DependsOnTargets="ResolveAssemblyReferences;GetCppWinRTDirectWinMDReferences;$(GetWV2WinRTDirectWinMDReferencesDependsOn)"
Returns="@(WV2WinRTDirectWinMDReferences)">
<ItemGroup>
<_WV2WinRTDirectWinMDReferences Remove="@(_WV2WinRTDirectWinMDReferences)"/>
<_WV2WinRTDirectWinMDReferences Include="@(CppWinRTDirectWinMDReferences)" Condition="'%(Filename)' != 'Microsoft.Web.WebView2.Core'"/>
<_WV2WinRTDirectWinMDReferences Include="@(CppWinRTDirectWinMDReferences)" Condition="'%(Filename)' == 'Microsoft.Web.WebView2.Core' And '$(WV2WinRTWrapWebViewTypes)' == 'true'"/>
<WV2WinRTDirectWinMDReferences Remove="@(WV2WinRTDirectWinMDReferences)"/>
<WV2WinRTDirectWinMDReferences Include="@(_WV2WinRTDirectWinMDReferences)"/>
</ItemGroup>
<Message Text="WV2WinRTDirectWinMDReferences: &#xA;@(WV2WinRTDirectWinMDReferences->'%(FullPath)', '&#xA;')" Importance="$(WV2WinRTVerbosity)"/>
</Target>
<Target Name="GetWV2WinRTProjectWinMDReferences"
DependsOnTargets="GetCppWinRTProjectWinMDReferences;$(GetWV2WinRTProjectWinMDReferencesDependsOn)"
Returns="@(WV2WinRTProjectWinMDReferences)">
<ItemGroup>
<_WV2WinRTStaticProjectWinMDReferences Remove="@(_WV2WinRTStaticProjectWinMDReferences)"/>
<_WV2WinRTStaticProjectWinMDReferences Include="@(CppWinRTStaticProjectWinMDReferences)"/>
<WV2WinRTStaticProjectWinMDReferences Remove="@(WV2WinRTStaticProjectWinMDReferences)"/>
<WV2WinRTStaticProjectWinMDReferences Include="@(_WV2WinRTStaticProjectWinMDReferences)"/>
</ItemGroup>
<ItemGroup>
<_WV2WinRTDynamicProjectWinMDReferences Remove="@(_WV2WinRTDynamicProjectWinMDReferences)"/>
<_WV2WinRTDynamicProjectWinMDReferences Include="@(CppWinRTDynamicProjectWinMDReferences)"/>
<WV2WinRTDynamicProjectWinMDReferences Remove="@(WV2WinRTDynamicProjectWinMDReferences)"/>
<WV2WinRTDynamicProjectWinMDReferences Include="@(_WV2WinRTDynamicProjectWinMDReferences)"/>
</ItemGroup>
<ItemGroup>
<WV2WinRTProjectWinMDReferences Remove="@(WV2WinRTProjectWinMDReferences)"/>
<WV2WinRTProjectWinMDReferences Include="@(WV2WinRTStaticProjectWinMDReferences)"/>
<WV2WinRTProjectWinMDReferences Include="@(WV2WinRTDynamicProjectWinMDReferences)"/>
</ItemGroup>
<Message Text="WV2WinRTStaticProjectWinMDReferences: &#xA;@(WV2WinRTStaticProjectWinMDReferences->'%(FullPath)', '&#xA;')" Condition="'$(WV2WinRTLogIntermediateWinMDReferences)' == 'true'" Importance="$(WV2WinRTVerbosity)"/>
<Message Text="WV2WinRTDynamicProjectWinMDReferences: &#xA;@(WV2WinRTDynamicProjectWinMDReferences->'%(FullPath)', '&#xA;')" Condition="'$(WV2WinRTLogIntermediateWinMDReferences)' == 'true'" Importance="$(WV2WinRTVerbosity)"/>
<Message Text="WV2WinRTProjectWinMDReferences: &#xA;@(WV2WinRTProjectWinMDReferences->'%(FullPath)', '&#xA;')" Importance="$(WV2WinRTVerbosity)"/>
</Target>
<Target Name="GetWV2WinRTAdditionalWinMDReferences"
DependsOnTargets="$(GetWV2WinRTAdditionalWinMDReferencesDependsOn)"
Returns="@(WV2WinRTAdditionalWinMDReferences)">
<ItemGroup>
<WebView2WinRTAdditionalWinMDReferences Include="$(WebView2WinRTAdditionalWinMDReferences)"/>
</ItemGroup>
<ItemGroup>
<_WV2WinRTAdditionalWinMDReferences Remove="@(_WV2WinRTAdditionalWinMDReferences)"/>
<_WV2WinRTAdditionalWinMDReferences Include="@(WebView2WinRTAdditionalWinMDReferences)"/>
<WV2WinRTAdditionalWinMDReferences Remove="@(WV2WinRTAdditionalWinMDReferences)"/>
<WV2WinRTAdditionalWinMDReferences Include="@(_WV2WinRTAdditionalWinMDReferences)"/>
</ItemGroup>
<Message Text="WV2WinRTAdditionalWinMDReferences: &#xA;@(WV2WinRTAdditionalWinMDReferences->'%(FullPath)', '&#xA;')" Importance="$(WV2WinRTVerbosity)"/>
</Target>
<Target Name="GetWV2WinRTInputs"
DependsOnTargets="GetWV2WinRTPlatformWinMDReferences;GetWV2WinRTDirectWinMDReferences;GetWV2WinRTProjectWinMDReferences;GetWV2WinRTAdditionalWinMDReferences;CppWinRTMakeComponentProjection"
Outputs="$(WV2WinRTWinMDInputsResponseFile)">
<ItemGroup>
<_WV2WinRTInputs Remove="@(_WV2WinRTInputs)"/>
<_WV2WinRTInputs Include="@(WV2WinRTDirectWinMDReferences)"/>
<_WV2WinRTInputs Include="@(WV2WinRTPlatformWinMDReferences)" Condition="'$(WebView2WinRTWrapSystemTypes)' == 'true'"/>
<_WV2WinRTInputs Include="@(WV2WinRTProjectWinMDReferences)"/>
<_WV2WinRTInputs Include="@(WV2WinRTAdditionalWinMDReferences)"/>
<_WV2WinRTInputs Include="@(_CppwinrtCompInputs)"/>
<WV2WinRTInputs Remove="@(WV2WinRTInputs)"/>
<WV2WinRTInputs Include="@(_WV2WinRTInputs->'%(FullPath)'->Distinct())" Condition="'%(_WV2WinRTInputs.WinMDFile)' == 'true' or ('%(_WV2WinRTInputs.WinMDFile)' == '' and '%(_WV2WinRTInputs.Extension)' == '.winmd')">
<WinMDPath>%(FullPath)</WinMDPath>
</WV2WinRTInputs>
</ItemGroup>
<Error Condition="'@(_WV2WinRTInputs)' == '' And '$(WV2WinRTDisallowEmptyAdapter)' == 'true'" Text="No winmd inputs for WebView2 WinRT Projection"/>
<!-- Always write the wv2winrt_inputs.rsp file when the target runs, because the file is used as the output of this target. -->
<WriteLinesToFile
File="$(WV2WinRTWinMDInputsResponseFile)" Lines="@(WV2WinRTInputs)"
ContinueOnError="true" Overwrite="true" />
<Message Text="WV2WinRTInputs: &#xA;@(WV2WinRTInputs->'%(WinMDPath)', '&#xA;')" Importance="$(WV2WinRTVerbosity)"/>
</Target>
<Target Name="WV2WinRTComputeIdlParameters">
<PropertyGroup>
<WV2WinRTIdlParameters>--idl</WV2WinRTIdlParameters>
<WV2WinRTIdlParameters Condition="'$(WebView2DispatchAdapterOutputDir)' != ''">$(WV2WinRTIdlParameters) --output-path &quot;$(WebView2DispatchAdapterOutputDir.TrimEnd('\'))&quot;</WV2WinRTIdlParameters>
<WV2WinRTIdlParameters Condition="'$(WebView2DispatchAdapterNamespace)' != ''">$(WV2WinRTIdlParameters) --output-namespace $(WebView2DispatchAdapterNamespace)</WV2WinRTIdlParameters>
</PropertyGroup>
</Target>
<Target Name="WV2WinRTGenerateDispatchAdapterIdl"
DependsOnTargets="WV2WinRTComputeIdlParameters"
Inputs="$(WV2WinRTExe)"
Outputs="$(WebView2DispatchAdapterOutputDir)wv2winrt\DispatchAdapter.idl">
<PropertyGroup>
<WV2WinRTIdlCommand Condition="'$(WV2WinRTCommandPrefix)' != ''">$(WV2WinRTCommandPrefix) </WV2WinRTIdlCommand>
<WV2WinRTIdlCommand>$(WV2WinRTIdlCommand)&quot;$(WV2WinRTExe)&quot; $(WV2WinRTIdlParameters)</WV2WinRTIdlCommand>
</PropertyGroup>
<Message Text="$(WV2WinRTIdlCommand)" Importance="$(WV2WinRTVerbosity)"/>
<Exec Command="$(WV2WinRTIdlCommand)"/>
</Target>
<Target Name="WV2WinRTAddDispatchAdapterIdl"
DependsOnTargets="WV2WinRTGenerateDispatchAdapterIdl">
<ItemGroup>
<Midl Include="$(WebView2DispatchAdapterOutputDir)wv2winrt\DispatchAdapter.idl" />
</ItemGroup>
</Target>
<Target Name="WV2WinRTComputeParameters"
DependsOnTargets="GetWV2WinRTInputs"
Inputs="$(WV2WinRTWinMDInputsResponseFile)"
Outputs="$(IntDir)wv2winrt.rsp">
<ItemGroup>
<WV2WinRTIncludeFilters Remove="@(WV2WinRTIncludeFilters)"/>
<WV2WinRTIncludeFilters Include="$(WebView2DispatchAdapterIncludeFilters)"/>
<WV2WinRTIncludeFilters Include="@(WebView2DispatchAdapterIncludeFilters)"/>
<WV2WinRTExcludeFilters Remove="@(WV2WinRTExcludeFilters)"/>
<WV2WinRTExcludeFilters Include="$(WebView2DispatchAdapterExcludeFilters)"/>
<WV2WinRTExcludeFilters Include="@(WebView2DispatchAdapterExcludeFilters)"/>
</ItemGroup>
<ItemGroup>
<_PCH Include="@(ClCompile->Metadata('PrecompiledHeaderFile')->Distinct())"/>
</ItemGroup>
<Error Condition="'@(_PCH->Count())' &gt; '1'" Text="wv2winrt only supports a single PCH."/>
<PropertyGroup>
<_PCH>@(_PCH->Distinct())</_PCH>
</PropertyGroup>
<PropertyGroup>
<WV2WinRTParameters Condition="'$(WebView2DispatchAdapterOutputDir)' != ''">--output-path &quot;$(WebView2DispatchAdapterOutputDir.TrimEnd('\'))&quot;</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(WebView2DispatchAdapterNamespace)' != ''">$(WV2WinRTParameters) --output-namespace $(WebView2DispatchAdapterNamespace)</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(WebView2DispatchAdapterNamespace)' != '$(RootNamespace)'">$(WV2WinRTParameters) --use-full-namespace</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(WebView2DispatchAdapterUseJavaScriptCase)' == 'true'">$(WV2WinRTParameters) --use-javascript-case</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(WV2WinRTExplicitIncludesOnly)' == 'true'">$(WV2WinRTParameters) --explicit-includes-only</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(WV2WinRTRequireAllowForWebAttribute)' == 'true'">$(WV2WinRTParameters) --require-allow-for-web-attribute</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(WV2WinRTIgnoreWebHostHiddenAttribute)' == 'true'">$(WV2WinRTParameters) --ignore-web-host-hidden-attribute</WV2WinRTParameters>
<WV2WinRTParameters Condition="'@(WV2WinRTIncludeFilters)' != ''">$(WV2WinRTParameters) --include @(WV2WinRTIncludeFilters, ' ')</WV2WinRTParameters>
<WV2WinRTParameters Condition="'@(WV2WinRTExcludeFilters)' != ''">$(WV2WinRTParameters) --exclude @(WV2WinRTExcludeFilters, ' ')</WV2WinRTParameters>
<WV2WinRTParameters Condition="'@(WV2WinRTInputs)' != ''">$(WV2WinRTParameters) --winmd-paths @(WV2WinRTInputs->'&quot;%(WinMDPath)&quot;', ' ')</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(WV2WinRTVerbosity)' == 'high'">$(WV2WinRTParameters) --verbose</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(_PCH)' != ''">$(WV2WinRTParameters) --pch &quot;$(_PCH)&quot;</WV2WinRTParameters>
<WV2WinRTParameters Condition="'$(WV2WinRTAdditionalParameters)' != ''">$(WV2WinRTParameters) $(WV2WinRTAdditionalParameters)</WV2WinRTParameters>
</PropertyGroup>
<!-- Always write the wv2winrt.rsp file when the target runs, because the file is used as the output of this target. -->
<WriteLinesToFile
File="$(IntDir)wv2winrt.rsp" Lines="$(WV2WinRTParameters)"
ContinueOnError="true" Overwrite="true" />
</Target>
<Target Name="WV2WinRTMakeProjections"
Condition="'$(WV2WinRTSkipMakeProjections)' != 'true'"
DependsOnTargets="WV2WinRTComputeParameters"
Inputs="$(IntDir)wv2winrt.rsp"
Outputs="$(WebView2DispatchAdapterOutputDir)wv2winrt\**">
<PropertyGroup>
<WV2WinRTCommand Condition="'$(WV2WinRTCommandPrefix)' != ''">$(WV2WinRTCommandPrefix) </WV2WinRTCommand>
<WV2WinRTCommand>$(WV2WinRTCommand)&quot;$(WV2WinRTExe)&quot; $(WV2WinRTParameters)</WV2WinRTCommand>
</PropertyGroup>
<Message Text="$(WV2WinRTCommand)" Importance="$(WV2WinRTVerbosity)"/>
<Exec Command="$(WV2WinRTCommand)" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="WV2WinRTOutput"/>
</Exec>
</Target>
<Target Name="WV2WinRTAddGeneratedFiles"
DependsOnTargets="WV2WinRTMakeProjections">
<ItemGroup>
<_WV2WinRTFilesToBuild Remove="@(_WV2WinRTFilesToBuild)"/>
<_WV2WinRTFilesToBuild Include="$(WebView2DispatchAdapterOutputDir)wv2winrt\*.cpp"/>
<_WV2WinRTFilesToClean Include="$(WebView2DispatchAdapterOutputDir)wv2winrt\*.*"/>
</ItemGroup>
<ItemGroup>
<ClCompile Include="@(_WV2WinRTFilesToBuild)">
<ObjectFileName>$(IntDir)wv2winrt\</ObjectFileName>
</ClCompile>
<FileWrites Include="@(_WV2WinRTFilesToClean)" Condition="'$(WV2WinRTSkipMakeProjections)' != 'true'"/>
</ItemGroup>
<Message Text="GeneratedCppFiles: &#xA;@(_WV2WinRTFilesToBuild, '&#xA;')" Importance="$(WV2WinRTVerbosity)" />
</Target>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(WebView2DispatchAdapterOutputDir)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
</Project>