@@ -323,55 +323,61 @@ namespace Microsoft.Web.WebView2.Core
323323```
324324
325325## Sensitivity label change event
326- ### C++
327- ```
326+
327+ ### C++
328+
329+ ``` cpp
328330// / Represents the state of sensitivity label detection and processing
329- /// for web page loaded in the WebView2 control. This enum indicates
330- /// whether sensitivity labels have been detected, are being processed,
331- /// or are fully determined for the current web page content.
331+ // / for web content loaded in the WebView2 control.
332332[v1_enum]
333- typedef enum COREWEBVIEW2_SENSITIVITY_LABEL_STATE {
334- /// Indicates that none of the loaded pages are in the allow list. Hence
335- /// none will report sensitivity labels.
336- COREWEBVIEW2_SENSITIVITY_LABEL_STATE_NONE ,
337- /// Indicates that WebView2 has loaded pages from the allow list that can
338- /// report sensitivity labels, but the label determination is not yet
339- /// complete.
340- COREWEBVIEW2_SENSITIVITY_LABEL_STATE_UNDETERMINED ,
333+ typedef enum COREWEBVIEW2_SENSITIVITY_LABELS_STATE {
334+ /// Indicates that none of the loaded pages are in the allow list. Hence
335+ /// sensitivity labels are not applicable.
336+ COREWEBVIEW2_SENSITIVITY_LABELS_STATE_NOT_APPLICABLE ,
337+ /// Indicates that WebView2 has loaded pages from the allow list that
338+ /// can report sensitivity labels, but the label are not available
339+ /// yet complete.
340+ COREWEBVIEW2_SENSITIVITY_LABELS_STATE_PENDING ,
341341 /// Indicates that WebView2 has loaded pages from the allow list,
342- /// and those pages have provided label information .
343- COREWEBVIEW2_SENSITIVITY_LABEL_STATE_DETERMINED ,
344- } COREWEBVIEW2_SENSITIVITY_LABEL_STATE ;
342+ /// and the labels about the content are available now .
343+ COREWEBVIEW2_SENSITIVITY_LABELS_STATE_AVAILABLE ,
344+ } COREWEBVIEW2_SENSITIVITY_LABELS_STATE ;
345345
346- /// Represents the kind of sensitivity label applied to web page .
346+ // / Specifies the kind of sensitivity label applied to web content .
347347// / Sensitivity labels are used to classify and protect content based on
348348// / its sensitivity level.
349+ // /
350+ // / <remarks>
351+ // / This enumeration is designed to be extensible. New values may be added
352+ // / in future versions. Applications should not implement a default case
353+ // / that assumes knowledge of all possible label kinds to ensure forward
354+ // / compatibility.
355+ // / </remarks>
349356[v1_enum]
350357typedef enum COREWEBVIEW2_SENSITIVITY_LABEL_KIND {
351- /// Represents an unknown or unsupported sensitivity label.
352- COREWEBVIEW2_SENSITIVITY_LABEL_KIND_UNKNOWN,
353358 /// Represents a Microsoft Information Protection (MIP) sensitivity label.
354359 COREWEBVIEW2_SENSITIVITY_LABEL_KIND_MIP,
355360} COREWEBVIEW2_SENSITIVITY_LABEL_KIND;
356361
362+
357363// / Interface for different sensitivity label kinds used in WebView2.
358364// / This interface provides functionality for accessing sensitivity
359- /// label information applied to web page . Different label types
365+ // / label information applied to web content . Different label types
360366// / (such as Microsoft Information Protection labels) provide
361367// / specific label information and metadata.
362368[uuid(5c27e6f2-baa6-5646 -b726-db80a77b7345), object, pointer_default(unique)]
363- interface ICoreWebView2SensitivityLabel : IUnknown {
364- /// Gets the type of the sensitivity label applied to the web page .
369+ interface ICoreWebView2StagingSensitivityLabel : IUnknown {
370+ /// Gets the type of the sensitivity label applied to the web content .
365371 /// This property identifies which sensitivity label system is being used
366372 /// (such as Microsoft Information Protection or other label providers).
367373 /// Applications can use this information to determine how to interpret
368374 /// and handle the label data, as different label types may have different
369375 /// metadata formats, protection requirements, and policy enforcement
370376 /// mechanisms.
371- [propget] HRESULT LabelKind(
372- [out, retval] COREWEBVIEW2_SENSITIVITY_LABEL_KIND* value);
377+ [ propget] HRESULT LabelKind([ out, retval] COREWEBVIEW2_SENSITIVITY_LABEL_KIND* value);
373378}
374379
380+
375381// / Interface for Microsoft Information Protection (MIP) sensitivity labels.
376382// / This interface provides specific information about MIP labels, including
377383// / label identification and organizational context.
@@ -380,7 +386,7 @@ interface ICoreWebView2MipSensitivityLabel : IUnknown {
380386 /// The unique identifier for the Microsoft Information Protection label.
381387 /// This string contains a GUID that uniquely identifies the specific
382388 /// sensitivity label within the organization's MIP policy configuration.
383- /// The GUID is of type GUIDv4 and follows the format:
389+ /// The GUID follows the format:
384390 /// ` xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx `
385391 /// eg: ` 3fa85f64-5717-4562-b3fc-2c963f66afa6 `
386392 ///
@@ -391,7 +397,7 @@ interface ICoreWebView2MipSensitivityLabel : IUnknown {
391397 /// The unique identifier for the organization that owns the MIP label.
392398 /// This string contains a GUID that identifies the Azure Active Directory
393399 /// tenant or organization that configured and deployed the sensitivity label.
394- /// The GUID is of type GUIDv4 and follows the format:
400+ /// The GUID follows the format:
395401 /// ` xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx `
396402 /// eg: ` 44567f64-8712-1789-ac3f-15aa3f66ab12 `
397403 ///
@@ -409,133 +415,120 @@ interface ICoreWebView2SensitivityLabelCollectionView : IUnknown {
409415
410416 /// Gets the element at the given index.
411417 HRESULT GetValueAtIndex(
412- [in] UINT32 index,
418+ [ in] UINT32 index,
413419 [ out, retval] ICoreWebView2SensitivityLabel** value);
414420}
415421
416- /// Event arguments for the `SensitivityLabelChanged` event.
417- /// This interface provides information about sensitivity label changes
418- /// that occur when web page is loaded or updated in the WebView2 control.
419- /// The event args contain the current state of sensitivity label detection
420- /// and a collection of all sensitivity labels that have been reported by
421- /// the web page via
422- /// [`Page Interaction Restriction Manager`](https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/PageInteractionRestrictionManager/explainer.md).
423- [uuid(36de2060-e013-5b03-939b-117d08d0abd5), object, pointer_default(unique)]
424- interface ICoreWebView2SensitivityLabelEventArgs : IUnknown {
422+ // / This interface provides information about sensitivity of web page
423+ // / loaded in the WebView2 control. It contains the current state of
424+ // / sensitivity label detection and a collection of all sensitivity labels
425+ // / that have been reported by the web page via
426+ // / [`Page Interaction Restriction Manager`](https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/PageInteractionRestrictionManager/explainer.md).
427+ [uuid(ac075f6f-3a2b-5701 -ab52-9f01f1a61529), object, pointer_default(unique)]
428+ interface ICoreWebView2StagingSensitivityInfo : IUnknown {
425429 /// Gets a read-only collection of all sensitivity labels detected in the
426430 /// current web document. This collection contains instances of sensitivity
427- /// labels that have been reported by the web page .
428- [propget] HRESULT SensitivityLabels(
429- [out, retval] ICoreWebView2SensitivityLabelCollectionView** value);
430-
431+ /// labels that have been reported by the web content .
432+ /// ` SensitivityLabels ` are valid only if SensitivityState is
433+ /// ` COREWEBVIEW2_SENSITIVITY_LABELS_STATE_AVAILABLE ` .
434+ [ propget ] HRESULT SensitivityLabels( [ out, retval ] ICoreWebView2StagingSensitivityLabelCollectionView ** value);
431435
432436 /// Gets the current state of sensitivity label detection.
433- [propget] HRESULT SensitivityState(
434- [out, retval] COREWEBVIEW2_SENSITIVITY_LABEL_STATE* value);
435-
437+ /// Refer ` COREWEBVIEW2_SENSITIVITY_LABELS_STATE ` for different states.
438+ [ propget] HRESULT SensitivityState([ out, retval] COREWEBVIEW2_SENSITIVITY_LABELS_STATE* value);
436439}
437440
438- /// Receives `SensitivityLabelChanged ` events.
439- [uuid(927a011d-bbf3-546b-ba28-1fc0ef4c1f4a ), object, pointer_default(unique)]
440- interface ICoreWebView2SensitivityLabelChangedEventHandler : IUnknown {
441+ // / Receives `SensitivityInfoChanged ` events.
442+ [uuid(ada2e261- 0e15 -5b64- 8422 -f4373eb0d552 ), object, pointer_default(unique)]
443+ interface ICoreWebView2StagingSensitivityInfoChangedEventHandler : IUnknown {
441444 /// Provides the event args for the corresponding event.
442445 HRESULT Invoke(
443446 [ in] ICoreWebView2* sender,
444- [in] ICoreWebView2SensitivityLabelEventArgs * args);
447+ [ in] IUnknown * args);
445448}
446449
447450// / Extension of the ICoreWebView2 interface that provides sensitivity label
448451// / change notification capabilities. This interface enables applications to
449452// / monitor and respond to changes in the sensitivity classification of web
450453// / content loaded in the WebView2 control. When sensitivity labels are
451- /// detected, updated, or removed from web pages, the SensitivityLabelChanged
454+ // / detected, updated, or removed from web pages, the SensitivityInfoChanged
452455// / event is raised.
453- [uuid(ac4543d5-f466-5622-8b3b-24d3b195525c), object, pointer_default(unique)]
454- interface ICoreWebView2_32 : IUnknown {
455- /// Adds an event handler for the `SensitivityLabelChanged` event.
456- /// Event raised when the sensitivity label classification of web page
457- /// changes. web pages may report sensitivity labels via
456+ [uuid(862c39a8-f64f-5a97-bae2-db5651020b34), object, pointer_default(unique)]
457+ interface ICoreWebView2Staging32 : IUnknown {
458+ /// Gets the current state of sensitivity label detection for the content
459+ /// loaded in the WebView2 control.
460+ /// See ` ICoreWebView2SensitivityInfo ` for more details.
461+ [ propget] HRESULT SensitivityInfo([ out, retval] ICoreWebView2StagingSensitivityInfo** value);
462+
463+ /// Adds an event handler for the ` SensitivityInfoChanged ` event.
464+ /// Event raised when the sensitivity label classification of web page changes.
465+ /// Web page may report sensitivity labels via
458466 /// [ ` Page Interaction Restriction Manager ` ] ( https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/PageInteractionRestrictionManager/explainer.md ) .
459- /// This event is triggered when the WebView2 control detects a change in
460- /// the sensitivity labels associated with the currently loaded web page.
467+ /// This event is triggered when the WebView2 control detects a change in the
468+ /// sensitivity labels associated with the currently loaded web page.
461469 /// Changes can occur when navigating to a new page in the main frame,
462470 /// when the existing page updates its sensitivity label information.
463- /// On navigation to a new page `SensitivityLabelChanged ` event is raised
464- /// after the `NavigationCompleted ` event. Applications can subscribe to
465- /// this event to receive notifications about sensitivity changes. The
466- /// event args provide the current label state and the complete collection
467- /// of detected sensitivity labels. the complete collection of detected
468- /// sensitivity labels .
469- HRESULT add_SensitivityLabelChanged (
470- [in] ICoreWebView2SensitivityLabelChangedEventHandler * eventHandler,
471+ /// On navigation to a new page ` SensitivityInfoChanged ` event is raised
472+ /// just after the ` NavigationStarting ` event. Applications can subscribe
473+ /// to this event to receive notifications about sensitivity changes.
474+ /// The event handler can then query the ` SensitivityInfo ` property
475+ /// to get the latest sensitivity label information and take appropriate
476+ /// actions based on the updated sensitivity classification .
477+ HRESULT add_SensitivityInfoChanged (
478+ [ in] ICoreWebView2StagingSensitivityInfoChangedEventHandler * eventHandler,
471479 [ out] EventRegistrationToken* token);
472480
473- /// Removes an event handler previously added with
474- /// `add_SensitivityLabelChanged`.
475- HRESULT remove_SensitivityLabelChanged(
481+ /// Removes an event handler previously added with ` add_SensitivityInfoChanged ` .
482+ HRESULT remove_SensitivityInfoChanged(
476483 [ in] EventRegistrationToken token);
477-
478484}
479485```
486+
480487### .NET/WinRT
488+
481489``` c#
482490enum CoreWebView2SensitivityLabelKind
483491{
484- Unknown = 0 ,
485- Mip = 1 ,
492+ Mip = 0 ,
486493};
487494
488- enum CoreWebView2SensitivityLabelState
495+ enum CoreWebView2SensitivityLabelsState
489496{
490- None = 0 ,
491- Undetermined = 1 ,
492- Determined = 2 ,
497+ NotApplicable = 0 ,
498+ Pending = 1 ,
499+ Available = 2 ,
493500};
494501
495- runtimeclass CoreWebView2SensitivityLabelEventArgs
502+ runtimeclass CoreWebView2SensitivityLabel
496503{
497- // ICoreWebView2SensitivityLabelEventArgs members
498- IVectorView < CoreWebView2SensitivityLabel > SensitivityLabels { get ; };
499-
500- CoreWebView2SensitivityLabelState SensitivityState { get ; };
504+ // ICoreWebView2StagingSensitivityLabel members
505+ CoreWebView2SensitivityLabelKind LabelKind { get ; };
501506}
502507
503- runtimeclass CoreWebView2SensitivityLabelCollectionView
508+ runtimeclass CoreWebView2SensitivityInfo
504509{
505- // ICoreWebView2SensitivityLabelCollectionView members
506- UInt32 Count { get ; };
510+ // ICoreWebView2StagingSensitivityInfo members
511+ IVectorView < CoreWebView2SensitivityLabel > SensitivityLabels { get ; };
507512
508- CoreWebView2SensitivityLabel GetValueAtIndex ( UInt32 index ) ;
513+ CoreWebView2SensitivityLabelsState SensitivityState { get ; } ;
509514}
510515
511- runtimeclass CoreWebView2SensitivityLabel
512- {
513- // ICoreWebView2SensitivityLabel members
514- CoreWebView2SensitivityLabelType LabelType { get ; };
515- }
516516
517517runtimeclass CoreWebView2MipSensitivityLabel
518518{
519- // ICoreWebView2MipSensitivityLabel members
519+ // ICoreWebView2StagingMipSensitivityLabel members
520520 String LabelId { get ; };
521521
522522 String OrganizationId { get ; };
523523}
524-
525- runtimeclass CoreWebView2SensitivityLabelEventArgs
526- {
527- // ICoreWebView2SensitivityLabelEventArgs members
528- IVectorView < CoreWebView2SensitivityLabel > SensitivityLabels { get ; };
529-
530- CoreWebView2SensitivityLabelState SensitivityState { get ; };
531- }
532-
533524runtimeclass CoreWebView2
534525{
535- [interface_name (" Microsoft.Web.WebView2.Core.ICoreWebView2_32 " )]
526+ [interface_name (" Microsoft.Web.WebView2.Core.ICoreWebView2Staging32 " )]
536527 {
537- // ICoreWebView2_32 members
538- event Windows .Foundation .TypedEventHandler < CoreWebView2 , CoreWebView2SensitivityLabelEventArgs > SensitivityLabelChanged ;
528+ // ICoreWebView2Staging32 members
529+ CoreWebView2SensitivityInfo SensitivityInfo { get ; };
530+
531+ event Windows .Foundation .TypedEventHandler < CoreWebView2 , IInspectable > SensitivityInfoChanged ;
539532 }
540533}
541534```
0 commit comments