|
| 1 | +// Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +import "oaidl.idl"; |
| 6 | +// midl is run from a tools directory with no special include paths setup. |
| 7 | +// To import an IDL from the build you must get out of the tools path |
| 8 | +// first. |
| 9 | +// We include the shipping WebView2.idl so that our in interop APIs may |
| 10 | +// interact with our public APIs. |
| 11 | +import "../../edge_embedded_browser/client/win/current/WebView2.idl"; |
| 12 | + |
| 13 | +[uuid(79b85709-2a19-4645-9722-3cc51b86eda7), version(1.0)] |
| 14 | +library WebView2Interop { |
| 15 | + |
| 16 | +// Forward declarations |
| 17 | +interface ICoreWebView2Interop; |
| 18 | +interface ICoreWebView2Interop2; |
| 19 | +interface ICoreWebView2CompositionControllerInterop; |
| 20 | +interface ICoreWebView2CompositionControllerInterop2; |
| 21 | +interface ICoreWebView2EnvironmentInterop; |
| 22 | + |
| 23 | +// Enums and structs |
| 24 | +// End of enums and structs |
| 25 | + |
| 26 | +/// Interop interface for the CoreWebView2 WinRT object to allow WinRT end |
| 27 | +/// developers to be able to use COM interfaces as parameters for some methods. |
| 28 | +/// This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2 |
| 29 | +/// runtime class. |
| 30 | +[uuid(912b34a7-d10b-49c4-af18-7cb7e604e01a), object, pointer_default(unique)] |
| 31 | +interface ICoreWebView2Interop : IUnknown { |
| 32 | + /// Add the provided host object to script running in the WebView with the |
| 33 | + /// specified name. |
| 34 | + /// See the documentation for ICoreWebView2::AddHostObjectToScript for more |
| 35 | + /// information. |
| 36 | + HRESULT AddHostObjectToScript([in] LPCWSTR name, [in] VARIANT* object); |
| 37 | +} |
| 38 | + |
| 39 | +/// Interop interface for the CoreWebView2 WinRT object to allow WinRT end |
| 40 | +/// developers to be able to use COM interfaces as parameters for some methods. |
| 41 | +/// This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2 |
| 42 | +/// runtime class. |
| 43 | +[uuid(B151AD7C-CFB0-4ECF-B9B2-AFCA868581A6), object, pointer_default(unique)] |
| 44 | +interface ICoreWebView2Interop2 : IUnknown { |
| 45 | + /// Get a COM ICoreWebView2 interface corresponding to this WinRT CoreWebView2 |
| 46 | + /// object. |
| 47 | + HRESULT GetComICoreWebView2([out, retval] ICoreWebView2** coreWebView2); |
| 48 | +} |
| 49 | + |
| 50 | +/// Interop interface for the CoreWebView2CompositionController WinRT object to |
| 51 | +/// allow WinRT end developers to be able to use the COM interfaces as parameters |
| 52 | +/// for some methods. |
| 53 | +/// This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2CompositionController |
| 54 | +/// runtime class. |
| 55 | +[uuid(8e9922ce-9c80-42e6-bad7-fcebf291a495), object, pointer_default(unique)] |
| 56 | +interface ICoreWebView2CompositionControllerInterop : IUnknown { |
| 57 | + /// Returns the UI Automation Provider for the WebView. See the documentation for |
| 58 | + /// ICoreWebView2CompositionController::AutomationProvider for more information. |
| 59 | + [propget] HRESULT AutomationProvider([out, retval] IUnknown** provider); |
| 60 | + |
| 61 | + /// The RootVisualTarget is a visual in the hosting app's visual tree. This |
| 62 | + /// visual is where the WebView2 will connect its visual tree. |
| 63 | + /// See the documentation for ICoreWebView2CompositionController::RootVisualTarget |
| 64 | + /// for more information. |
| 65 | + [propget] HRESULT RootVisualTarget([out, retval] IUnknown** target); |
| 66 | + /// Set the RootVisualTarget property. |
| 67 | + [propput] HRESULT RootVisualTarget([in] IUnknown* target); |
| 68 | +} |
| 69 | + |
| 70 | +/// This interface is the continuation of the |
| 71 | +/// ICoreWebView2CompositionControllerInterop interface to manage drag and drop. |
| 72 | +[uuid(6b47bbe1-2480-4ff8-a5ba-69c2f0b868b3), object, pointer_default(unique)] |
| 73 | +interface ICoreWebView2CompositionControllerInterop2 : ICoreWebView2CompositionControllerInterop { |
| 74 | + /// This function corresponds to [IDropTarget::DragEnter](/windows/win32/api/oleidl/nf-oleidl-idroptarget-dragenter). |
| 75 | + /// |
| 76 | + /// This function has a dependency on AllowExternalDrop property of |
| 77 | + /// CoreWebView2Controller and return E_FAIL to callers to indicate this |
| 78 | + /// operation is not allowed if AllowExternalDrop property is set to false. |
| 79 | + /// |
| 80 | + /// The hosting application must register as an IDropTarget and implement |
| 81 | + /// and forward DragEnter calls to this function. |
| 82 | + /// |
| 83 | + /// point parameter must be modified to include the WebView's offset and be in |
| 84 | + /// the WebView's client coordinates (Similar to how SendMouseInput works). |
| 85 | + /// |
| 86 | + /// \snippet DropTarget.cpp DragEnter |
| 87 | + HRESULT DragEnter( |
| 88 | + [in] IDataObject* dataObject, |
| 89 | + [in] DWORD keyState, |
| 90 | + [in] POINT point, |
| 91 | + [out, retval] DWORD* effect); |
| 92 | + |
| 93 | + /// This function corresponds to [IDropTarget::DragLeave](/windows/win32/api/oleidl/nf-oleidl-idroptarget-dragleave). |
| 94 | + /// |
| 95 | + /// This function has a dependency on AllowExternalDrop property of |
| 96 | + /// CoreWebView2Controller and return E_FAIL to callers to indicate this |
| 97 | + /// operation is not allowed if AllowExternalDrop property is set to false. |
| 98 | + /// |
| 99 | + /// The hosting application must register as an IDropTarget and implement |
| 100 | + /// and forward DragLeave calls to this function. |
| 101 | + /// |
| 102 | + /// \snippet DropTarget.cpp DragLeave |
| 103 | + HRESULT DragLeave(); |
| 104 | + |
| 105 | + /// This function corresponds to [IDropTarget::DragOver](/windows/win32/api/oleidl/nf-oleidl-idroptarget-dragover). |
| 106 | + /// |
| 107 | + /// This function has a dependency on AllowExternalDrop property of |
| 108 | + /// CoreWebView2Controller and return E_FAIL to callers to indicate this |
| 109 | + /// operation is not allowed if AllowExternalDrop property is set to false. |
| 110 | + /// |
| 111 | + /// The hosting application must register as an IDropTarget and implement |
| 112 | + /// and forward DragOver calls to this function. |
| 113 | + /// |
| 114 | + /// point parameter must be modified to include the WebView's offset and be in |
| 115 | + /// the WebView's client coordinates (Similar to how SendMouseInput works). |
| 116 | + /// |
| 117 | + /// \snippet DropTarget.cpp DragOver |
| 118 | + HRESULT DragOver( |
| 119 | + [in] DWORD keyState, |
| 120 | + [in] POINT point, |
| 121 | + [out, retval] DWORD* effect); |
| 122 | + |
| 123 | + /// This function corresponds to [IDropTarget::Drop](/windows/win32/api/oleidl/nf-oleidl-idroptarget-drop). |
| 124 | + /// |
| 125 | + /// This function has a dependency on AllowExternalDrop property of |
| 126 | + /// CoreWebView2Controller and return E_FAIL to callers to indicate this |
| 127 | + /// operation is not allowed if AllowExternalDrop property is set to false. |
| 128 | + /// |
| 129 | + /// The hosting application must register as an IDropTarget and implement |
| 130 | + /// and forward Drop calls to this function. |
| 131 | + /// |
| 132 | + /// point parameter must be modified to include the WebView's offset and be in |
| 133 | + /// the WebView's client coordinates (Similar to how SendMouseInput works). |
| 134 | + /// |
| 135 | + /// \snippet DropTarget.cpp Drop |
| 136 | + HRESULT Drop( |
| 137 | + [in] IDataObject* dataObject, |
| 138 | + [in] DWORD keyState, |
| 139 | + [in] POINT point, |
| 140 | + [out, retval] DWORD* effect); |
| 141 | + |
| 142 | +} |
| 143 | + |
| 144 | +/// Interop interface for the CoreWebView2Environment WinRT object to allow |
| 145 | +/// WinRT end developers to be able to use COM interfaces as parameters for some |
| 146 | +/// methods. |
| 147 | +/// This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2Environment |
| 148 | +/// runtime class. |
| 149 | +[uuid(ee503a63-c1e2-4fbf-8a4d-824e95f8bb13), object, pointer_default(unique)] |
| 150 | +interface ICoreWebView2EnvironmentInterop : IUnknown { |
| 151 | + /// Returns the UI Automation Provider for the |
| 152 | + /// ICoreWebView2CompositionController that corresponds with the given HWND. |
| 153 | + /// See the documentation for ICoreWebView2Environment::GetAutomationProviderForWindow |
| 154 | + /// for more information. |
| 155 | + HRESULT GetAutomationProviderForWindow([in] HWND hwnd, |
| 156 | + [out, retval] IUnknown** provider); |
| 157 | +} |
| 158 | + |
| 159 | +/// Interop interface for the CoreWebView2CompositionController WinRT object to |
| 160 | +/// allow WinRT end developers to be able to access the COM interface arguments. |
| 161 | +/// This interface is implemented by the |
| 162 | +/// Microsoft.Web.WebView2.Core.CoreWebView2CompositionController runtime class. |
| 163 | +[uuid(b211edcf-7ef3-44ad-8aed-4d3ef0af1813), object, pointer_default(unique)] |
| 164 | +interface ICoreWebView2CompositionControllerInterop3 : ICoreWebView2CompositionControllerInterop2 { |
| 165 | + /// Adds an event handler for the `DragStarting` event. `DragStarting` is |
| 166 | + /// raised when the WebView2 detects a drag started within the WebView2. |
| 167 | + /// This event can be used to override WebView2's default drag starting |
| 168 | + /// logic. |
| 169 | + HRESULT add_DragStarting( |
| 170 | + [in] ICoreWebView2DragStartingEventHandler* eventHandler, |
| 171 | + [out] EventRegistrationToken* token); |
| 172 | + |
| 173 | + /// Removes an event handler previously added with `add_DragStarting`. |
| 174 | + HRESULT remove_DragStarting( |
| 175 | + [in] EventRegistrationToken token); |
| 176 | + |
| 177 | + |
| 178 | +} |
| 179 | + |
| 180 | +// End of interfaces |
| 181 | + |
| 182 | +} |
0 commit comments