@@ -24,16 +24,15 @@ ScenarioNotificationReceived::ScenarioNotificationReceived(AppWindow* appWindow)
2424 : m_appWindow(appWindow), m_webView(appWindow->GetWebView ())
2525{
2626 m_sampleUri = m_appWindow->GetLocalUri (c_samplePath);
27- m_webView2Experimental22 = m_webView.try_query <ICoreWebView2Experimental22 >();
28- if (!m_webView2Experimental22 )
27+ m_webView2_24 = m_webView.try_query <ICoreWebView2_24 >();
28+ if (!m_webView2_24 )
2929 return ;
3030 // ! [NotificationReceived]
3131 // Register a handler for the NotificationReceived event.
32- CHECK_FAILURE (m_webView2Experimental22->add_NotificationReceived (
33- Callback<ICoreWebView2ExperimentalNotificationReceivedEventHandler>(
34- [this ](
35- ICoreWebView2* sender,
36- ICoreWebView2ExperimentalNotificationReceivedEventArgs* args) -> HRESULT
32+ CHECK_FAILURE (m_webView2_24->add_NotificationReceived (
33+ Callback<ICoreWebView2NotificationReceivedEventHandler>(
34+ [this ](ICoreWebView2* sender, ICoreWebView2NotificationReceivedEventArgs* args)
35+ -> HRESULT
3736 {
3837 // Block notifications from specific URIs and set Handled to
3938 // true so the the default notification UI will not be
@@ -45,14 +44,13 @@ ScenarioNotificationReceived::ScenarioNotificationReceived(AppWindow* appWindow)
4544 wil::unique_cotaskmem_string origin;
4645 CHECK_FAILURE (args->get_SenderOrigin (&origin));
4746 std::wstring originString = origin.get ();
48- Microsoft::WRL::ComPtr<ICoreWebView2ExperimentalNotification > notification;
47+ Microsoft::WRL::ComPtr<ICoreWebView2Notification > notification;
4948 CHECK_FAILURE (args->get_Notification (¬ification));
5049
5150 notification->add_CloseRequested (
52- Callback<ICoreWebView2ExperimentalNotificationCloseRequestedEventHandler >(
51+ Callback<ICoreWebView2NotificationCloseRequestedEventHandler >(
5352 [this , &sender](
54- ICoreWebView2ExperimentalNotification* notification,
55- IUnknown* args) -> HRESULT
53+ ICoreWebView2Notification* notification, IUnknown* args) -> HRESULT
5654 {
5755 // Remove the notification from the list of active
5856 // notifications.
@@ -64,8 +62,8 @@ ScenarioNotificationReceived::ScenarioNotificationReceived(AppWindow* appWindow)
6462
6563 m_appWindow->RunAsync (
6664 [this ,
67- notificationCom = wil::make_com_ptr<ICoreWebView2ExperimentalNotification>(
68- notification.Get ()),
65+ notificationCom =
66+ wil::make_com_ptr<ICoreWebView2Notification>( notification.Get ()),
6967 deferral, originString]()
7068 {
7169 ShowNotification (notificationCom.get (), originString);
@@ -95,7 +93,7 @@ bool ScenarioNotificationReceived::HandleWindowMessage(
9593}
9694
9795void ScenarioNotificationReceived::ShowNotification (
98- ICoreWebView2ExperimentalNotification * notification, std::wstring origin)
96+ ICoreWebView2Notification * notification, std::wstring origin)
9997{
10098 ICoreWebView2* webView = m_webView.get ();
10199 wil::unique_cotaskmem_string title;
@@ -139,8 +137,7 @@ void ScenarioNotificationReceived::ShowNotification(
139137 (response == IDOK) ? notification->ReportClicked () : notification->ReportClosed ();
140138}
141139
142- void ScenarioNotificationReceived::RemoveNotification (
143- ICoreWebView2ExperimentalNotification* notification)
140+ void ScenarioNotificationReceived::RemoveNotification (ICoreWebView2Notification* notification)
144141{
145142 // Close custom notification.
146143
@@ -155,9 +152,8 @@ void ScenarioNotificationReceived::NavigateToNotificationPage()
155152
156153ScenarioNotificationReceived::~ScenarioNotificationReceived ()
157154{
158- if (m_webView2Experimental22 )
155+ if (m_webView2_24 )
159156 {
160- CHECK_FAILURE (
161- m_webView2Experimental22->remove_NotificationReceived (m_notificationReceivedToken));
157+ CHECK_FAILURE (m_webView2_24->remove_NotificationReceived (m_notificationReceivedToken));
162158 }
163159}
0 commit comments