Skip to content

Commit a8ce792

Browse files
Add dotnet winrt for label event
1 parent e32a3a7 commit a8ce792

1 file changed

Lines changed: 71 additions & 23 deletions

File tree

specs/SensitivityLabel.md

Lines changed: 71 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ Sensitivity label support for Webview2
44
# Background
55
Web pages may contain content with sensitive information. Such information can be identified using data loss protection (DLP) methods. The purpose of this API is to provide sensitivity label information, communicated by web pages through the [PageInteractionRestrictionManager](https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/PageInteractionRestrictionManager/explainer.md), to the host application. This enables the host application to be informed of the presence of sensitive content.
66

7-
## Note about .NET/WinRT projection
8-
The work to project this API to .NET and WinRT are yet to be completed.
9-
107
# Description
118

129
This API introduces a SensitivityLabelChanged event to the CoreWebView2 object, enabling applications to monitor changes in sensitivity labels within hosted content. This functionality is restricted to domains explicitly included in an allow list configured by the application. The allow list can be set at the profile level, thereby enabling the Page Interaction Restriction Manager for content within specified domains. By default, the allow list is empty, preventing hosted content from transmitting sensitivity label information.
@@ -23,8 +20,7 @@ The core features of this proposal are as follows:
2320

2421
Configure the PageInteractionRestrictionManager allow list to enable Sensitivity label functionality on trusted domains.
2522

26-
27-
23+
### C++ Sample
2824
```cpp
2925
void ConfigureAllowlist()
3026
{
@@ -66,6 +62,7 @@ void ConfigureAllowlist()
6662
}
6763
}
6864
```
65+
### .NET/WinRT
6966
```c#
7067
// Configure allowlist for trusted company URLs
7168
var allowlist = new List<string>
@@ -84,7 +81,7 @@ MessageBox.Show($"Allowlist configured with {allowlist.Count} URLs");
8481

8582

8683
## Retrieving current allow list
87-
84+
### C++ Sample
8885
```cpp
8986
void GetCurrentAllowlist()
9087
{
@@ -108,7 +105,7 @@ void GetCurrentAllowlist()
108105
}
109106
```
110107

111-
108+
### .NET/WinRT
112109
```c#
113110
// Get current allowlist
114111
var currentAllowlist = webView2Control.CoreWebView2.Profile.PageInteractionRestrictionManagerAllowlist;
@@ -122,7 +119,7 @@ foreach (var url in currentAllowlist)
122119

123120

124121
## Register for sensitivity label change
125-
122+
### C++ Sample
126123
```cpp
127124
AppWindow* m_appWindow;
128125
wil::com_ptr<ICoreWebView2> m_webView;
@@ -237,6 +234,7 @@ void RegisterForSensitivityLabelChange()
237234
# API Details
238235

239236
## Allow listing
237+
### C++
240238

241239
```
242240
[uuid(764ffcc6-b341-5307-8ca4-58face289427), object, pointer_default(unique)]
@@ -261,7 +259,7 @@ interface ICoreWebView2StagingProfile3 : IUnknown {
261259
[propput] HRESULT PageInteractionRestrictionManagerAllowlist([in] ICoreWebView2StringCollection* value);
262260
}
263261
```
264-
262+
### .NET/WinRT
265263
```c#
266264
namespace Microsoft.Web.WebView2.Core
267265
{
@@ -278,6 +276,7 @@ namespace Microsoft.Web.WebView2.Core
278276
```
279277

280278
## Sensitivity label change event
279+
### C++
281280
```
282281
/// Represents the state of sensitivity label detection and processing
283282
/// for web content loaded in the WebView2 control. This enum indicates
@@ -296,9 +295,7 @@ typedef enum COREWEBVIEW2_SENSITIVITY_LABEL_STATE {
296295
/// and the content has reported label information to WebView2.
297296
COREWEBVIEW2_SENSITIVITY_LABEL_STATE_DETERMINED,
298297
} COREWEBVIEW2_SENSITIVITY_LABEL_STATE;
299-
```
300298
301-
```
302299
/// Represents the type of sensitivity label applied to web content.
303300
/// Sensitivity labels are used to classify and protect content based on
304301
/// its sensitivity level.
@@ -309,9 +306,7 @@ typedef enum COREWEBVIEW2_SENSITIVITY_LABEL_TYPE {
309306
/// Represents a Microsoft Information Protection (MIP) sensitivity label.
310307
COREWEBVIEW2_SENSITIVITY_LABEL_TYPE_MIP,
311308
} COREWEBVIEW2_SENSITIVITY_LABEL_TYPE;
312-
```
313309
314-
```
315310
/// Base interface for all sensitivity label types used in WebView2.
316311
/// This interface provides common functionality for accessing sensitivity
317312
/// label information applied to web content. Different label types
@@ -328,8 +323,7 @@ interface ICoreWebView2SensitivityLabel : IUnknown {
328323
/// mechanisms.
329324
[propget] HRESULT LabelType([out, retval] COREWEBVIEW2_SENSITIVITY_LABEL_TYPE* value);
330325
}
331-
```
332-
```
326+
333327
/// Interface for Microsoft Information Protection (MIP) sensitivity labels.
334328
/// This interface provides specific information about MIP labels, including
335329
/// label identification and organizational context.
@@ -353,9 +347,7 @@ interface ICoreWebView2StagingMipSensitivityLabel : IUnknown {
353347
[propget] HRESULT OrganizationId([out, retval] LPWSTR* value);
354348
355349
}
356-
```
357350
358-
```
359351
/// A collection of ICoreWebView2StagingSensitivityLabel.
360352
[uuid(2cb85219-0878-5f38-b7e9-769fab6ff887), object, pointer_default(unique)]
361353
interface ICoreWebView2StagingSensitivityLabelCollectionView : IUnknown {
@@ -365,9 +357,7 @@ interface ICoreWebView2StagingSensitivityLabelCollectionView : IUnknown {
365357
/// Gets the element at the given index.
366358
HRESULT GetValueAtIndex([in] UINT32 index, [out, retval] ICoreWebView2StagingSensitivityLabel** value);
367359
}
368-
```
369360
370-
```
371361
/// Event arguments for the `SensitivityLabelChanged` event.
372362
/// This interface provides information about sensitivity label changes
373363
/// that occur when web content is loaded or updated in the WebView2 control.
@@ -387,9 +377,7 @@ interface ICoreWebView2StagingSensitivityLabelEventArgs : IUnknown {
387377
[propget] HRESULT SensitivityState([out, retval] COREWEBVIEW2_SENSITIVITY_LABEL_STATE* value);
388378
389379
}
390-
```
391380
392-
```
393381
/// Receives `SensitivityLabelChanged` events.
394382
[uuid(927a011d-bbf3-546b-ba28-1fc0ef4c1f4a), object, pointer_default(unique)]
395383
interface ICoreWebView2StagingSensitivityLabelChangedEventHandler : IUnknown {
@@ -398,9 +386,7 @@ interface ICoreWebView2StagingSensitivityLabelChangedEventHandler : IUnknown {
398386
[in] ICoreWebView2* sender,
399387
[in] ICoreWebView2StagingSensitivityLabelEventArgs* args);
400388
}
401-
```
402389
403-
```
404390
/// Extension of the ICoreWebView2 interface that provides sensitivity label
405391
/// change notification capabilities. This interface enables applications to
406392
/// monitor and respond to changes in the sensitivity classification of web
@@ -426,3 +412,65 @@ interface ICoreWebView2Staging32 : IUnknown {
426412
427413
}
428414
```
415+
### .NET/WinRT
416+
```c#
417+
enum CoreWebView2SensitivityLabelType
418+
{
419+
Unknown = 0,
420+
Mip = 1,
421+
};
422+
423+
enum CoreWebView2SensitivityLabelState
424+
{
425+
None = 0,
426+
Undetermined = 1,
427+
Determined = 2,
428+
};
429+
430+
runtimeclass CoreWebView2SensitivityLabelEventArgs
431+
{
432+
// ICoreWebView2StagingSensitivityLabelEventArgs members
433+
IVectorView<CoreWebView2SensitivityLabel> SensitivityLabels { get; };
434+
435+
CoreWebView2SensitivityLabelState SensitivityState { get; };
436+
}
437+
438+
runtimeclass CoreWebView2SensitivityLabelCollectionView
439+
{
440+
// ICoreWebView2StagingSensitivityLabelCollectionView members
441+
UInt32 Count { get; };
442+
443+
CoreWebView2SensitivityLabel GetValueAtIndex(UInt32 index);
444+
}
445+
446+
runtimeclass CoreWebView2SensitivityLabel
447+
{
448+
// ICoreWebView2StagingSensitivityLabel members
449+
CoreWebView2SensitivityLabelType LabelType { get; };
450+
}
451+
452+
runtimeclass CoreWebView2MipSensitivityLabel
453+
{
454+
// ICoreWebView2StagingMipSensitivityLabel members
455+
String LabelId { get; };
456+
457+
String OrganizationId { get; };
458+
}
459+
460+
runtimeclass CoreWebView2SensitivityLabelEventArgs
461+
{
462+
// ICoreWebView2StagingSensitivityLabelEventArgs members
463+
IVectorView<CoreWebView2SensitivityLabel> SensitivityLabels { get; };
464+
465+
CoreWebView2SensitivityLabelState SensitivityState { get; };
466+
}
467+
468+
runtimeclass CoreWebView2
469+
{
470+
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2Staging32")]
471+
{
472+
// ICoreWebView2Staging32 members
473+
event Windows.Foundation.TypedEventHandler<CoreWebView2, CoreWebView2SensitivityLabelEventArgs> SensitivityLabelChanged;
474+
}
475+
}
476+
```

0 commit comments

Comments
 (0)