加入了浮动小游戏功能和设置界面
运行时请手动修改运行库目录fdBrowser
This commit is contained in:
+22
@@ -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>
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+640
@@ -0,0 +1,640 @@
|
||||
|
||||
|
||||
/* 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 __ICoreWebView2Interop2_FWD_DEFINED__
|
||||
#define __ICoreWebView2Interop2_FWD_DEFINED__
|
||||
typedef interface ICoreWebView2Interop2 ICoreWebView2Interop2;
|
||||
|
||||
#endif /* __ICoreWebView2Interop2_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"
|
||||
#include "WebView2.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 __ICoreWebView2Interop2_INTERFACE_DEFINED__
|
||||
#define __ICoreWebView2Interop2_INTERFACE_DEFINED__
|
||||
|
||||
/* interface ICoreWebView2Interop2 */
|
||||
/* [unique][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C __declspec(selectany) const IID IID_ICoreWebView2Interop2 = {0xB151AD7C,0xCFB0,0x4ECF,{0xB9,0xB2,0xAF,0xCA,0x86,0x85,0x81,0xA6}};
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("B151AD7C-CFB0-4ECF-B9B2-AFCA868581A6")
|
||||
ICoreWebView2Interop2 : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE GetComICoreWebView2(
|
||||
/* [retval][out] */ ICoreWebView2 **coreWebView2) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct ICoreWebView2Interop2Vtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
ICoreWebView2Interop2 * This,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ICoreWebView2Interop2 * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ICoreWebView2Interop2 * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(ICoreWebView2Interop2, GetComICoreWebView2)
|
||||
HRESULT ( STDMETHODCALLTYPE *GetComICoreWebView2 )(
|
||||
ICoreWebView2Interop2 * This,
|
||||
/* [retval][out] */ ICoreWebView2 **coreWebView2);
|
||||
|
||||
END_INTERFACE
|
||||
} ICoreWebView2Interop2Vtbl;
|
||||
|
||||
interface ICoreWebView2Interop2
|
||||
{
|
||||
CONST_VTBL struct ICoreWebView2Interop2Vtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define ICoreWebView2Interop2_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define ICoreWebView2Interop2_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define ICoreWebView2Interop2_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define ICoreWebView2Interop2_GetComICoreWebView2(This,coreWebView2) \
|
||||
( (This)->lpVtbl -> GetComICoreWebView2(This,coreWebView2) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __ICoreWebView2Interop2_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
|
||||
|
||||
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
// 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";
|
||||
// midl is run from a tools directory with no special include paths setup.
|
||||
// To import an IDL from the build you must get out of the tools path
|
||||
// first.
|
||||
// We include the shipping WebView2.idl so that our in interop APIs may
|
||||
// interact with our public APIs.
|
||||
import "../../edge_embedded_browser/client/win/current/WebView2.idl";
|
||||
|
||||
[uuid(79b85709-2a19-4645-9722-3cc51b86eda7), version(1.0)]
|
||||
library WebView2Interop {
|
||||
|
||||
// Forward declarations
|
||||
interface ICoreWebView2Interop;
|
||||
interface ICoreWebView2Interop2;
|
||||
interface ICoreWebView2CompositionControllerInterop;
|
||||
interface ICoreWebView2CompositionControllerInterop2;
|
||||
interface ICoreWebView2EnvironmentInterop;
|
||||
|
||||
// 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 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(B151AD7C-CFB0-4ECF-B9B2-AFCA868581A6), object, pointer_default(unique)]
|
||||
interface ICoreWebView2Interop2 : IUnknown {
|
||||
/// Get a COM ICoreWebView2 interface corresponding to this WinRT CoreWebView2
|
||||
/// object.
|
||||
HRESULT GetComICoreWebView2([out, retval] ICoreWebView2** coreWebView2);
|
||||
}
|
||||
|
||||
/// 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
|
||||
|
||||
}
|
||||
BIN
Binary file not shown.
+63639
File diff suppressed because it is too large
Load Diff
Vendored
+446
@@ -0,0 +1,446 @@
|
||||
// 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__
|
||||
|
||||
// Adding the definition of this macro to enable unsafe buffer usage
|
||||
#ifndef UNSAFE_BUFFERS
|
||||
#if defined(__clang__)
|
||||
|
||||
// clang-format off
|
||||
#define UNSAFE_BUFFERS(...) \
|
||||
_Pragma("clang unsafe_buffer_usage begin") \
|
||||
__VA_ARGS__ \
|
||||
_Pragma("clang unsafe_buffer_usage end")
|
||||
// clang-format on
|
||||
|
||||
#else
|
||||
#define UNSAFE_BUFFERS(...) __VA_ARGS__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UNSAFE_BUFFERS_BUILD
|
||||
// TODO(task.ms/57661138): Remove C-library calls to fix the errors.
|
||||
#pragma allow_unsafe_libc_calls
|
||||
#endif // UNSAFE_BUFFERS_BUILD
|
||||
|
||||
#include <objbase.h>
|
||||
#include <wrl/implements.h>
|
||||
|
||||
#include "WebView2.h"
|
||||
#define CORE_WEBVIEW_TARGET_PRODUCT_VERSION L"143.0.3650.58"
|
||||
|
||||
#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++) {
|
||||
UNSAFE_BUFFERS((*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++) {
|
||||
UNSAFE_BUFFERS(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)
|
||||
|
||||
// WebView2EnvironmentOptions.h this is a publicly exposed header to clients
|
||||
// and it used by them to integrate the webview2 enviorment as published at
|
||||
// https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.3179.45
|
||||
// This file is not included in msedge.dll/lib/exe and is limited to WebView2
|
||||
// SDK which does not use partition alloc. So need to use raw_ptr_exclusion
|
||||
// here.
|
||||
#if defined(__has_attribute)
|
||||
__attribute__((annotate("raw_ptr_exclusion")))
|
||||
#endif
|
||||
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 kAllChannels =
|
||||
COREWEBVIEW2_RELEASE_CHANNELS_STABLE |
|
||||
COREWEBVIEW2_RELEASE_CHANNELS_BETA | COREWEBVIEW2_RELEASE_CHANNELS_DEV |
|
||||
COREWEBVIEW2_RELEASE_CHANNELS_CANARY;
|
||||
|
||||
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++) {
|
||||
// SAFETY: Since we can't convert the raw buffer to safe type we do a
|
||||
// bound check and use the macro to mitigate the error.
|
||||
UNSAFE_BUFFERS(m_customSchemeRegistrations[i])->Release();
|
||||
}
|
||||
deallocate_fn(m_customSchemeRegistrations);
|
||||
m_customSchemeRegistrations = nullptr;
|
||||
m_customSchemeRegistrationsCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO(task.ms/56073082): Use raw_ptr.
|
||||
#if defined(__has_attribute)
|
||||
__attribute__((annotate("raw_ptr_exclusion")))
|
||||
#endif
|
||||
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++) {
|
||||
// SAFETY: Since we can't convert the raw buffer to safe type we do a
|
||||
// bound check and use the macro to mitigate the error.
|
||||
UNSAFE_BUFFERS((*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++) {
|
||||
// SAFETY: Since we can't convert the raw buffer to safe type we do a
|
||||
// bound check and use the macro to mitigate the error.
|
||||
UNSAFE_BUFFERS(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__
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user