@@ -24,16 +24,15 @@ ScenarioNotificationReceived::ScenarioNotificationReceived(AppWindow* appWindow)
24
24
: m_appWindow(appWindow), m_webView(appWindow->GetWebView ())
25
25
{
26
26
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 )
29
29
return ;
30
30
// ! [NotificationReceived]
31
31
// 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
37
36
{
38
37
// Block notifications from specific URIs and set Handled to
39
38
// true so the the default notification UI will not be
@@ -45,14 +44,13 @@ ScenarioNotificationReceived::ScenarioNotificationReceived(AppWindow* appWindow)
45
44
wil::unique_cotaskmem_string origin;
46
45
CHECK_FAILURE (args->get_SenderOrigin (&origin));
47
46
std::wstring originString = origin.get ();
48
- Microsoft::WRL::ComPtr<ICoreWebView2ExperimentalNotification > notification;
47
+ Microsoft::WRL::ComPtr<ICoreWebView2Notification > notification;
49
48
CHECK_FAILURE (args->get_Notification (¬ification));
50
49
51
50
notification->add_CloseRequested (
52
- Callback<ICoreWebView2ExperimentalNotificationCloseRequestedEventHandler >(
51
+ Callback<ICoreWebView2NotificationCloseRequestedEventHandler >(
53
52
[this , &sender](
54
- ICoreWebView2ExperimentalNotification* notification,
55
- IUnknown* args) -> HRESULT
53
+ ICoreWebView2Notification* notification, IUnknown* args) -> HRESULT
56
54
{
57
55
// Remove the notification from the list of active
58
56
// notifications.
@@ -64,8 +62,8 @@ ScenarioNotificationReceived::ScenarioNotificationReceived(AppWindow* appWindow)
64
62
65
63
m_appWindow->RunAsync (
66
64
[this ,
67
- notificationCom = wil::make_com_ptr<ICoreWebView2ExperimentalNotification>(
68
- notification.Get ()),
65
+ notificationCom =
66
+ wil::make_com_ptr<ICoreWebView2Notification>( notification.Get ()),
69
67
deferral, originString]()
70
68
{
71
69
ShowNotification (notificationCom.get (), originString);
@@ -95,7 +93,7 @@ bool ScenarioNotificationReceived::HandleWindowMessage(
95
93
}
96
94
97
95
void ScenarioNotificationReceived::ShowNotification (
98
- ICoreWebView2ExperimentalNotification * notification, std::wstring origin)
96
+ ICoreWebView2Notification * notification, std::wstring origin)
99
97
{
100
98
ICoreWebView2* webView = m_webView.get ();
101
99
wil::unique_cotaskmem_string title;
@@ -139,8 +137,7 @@ void ScenarioNotificationReceived::ShowNotification(
139
137
(response == IDOK) ? notification->ReportClicked () : notification->ReportClosed ();
140
138
}
141
139
142
- void ScenarioNotificationReceived::RemoveNotification (
143
- ICoreWebView2ExperimentalNotification* notification)
140
+ void ScenarioNotificationReceived::RemoveNotification (ICoreWebView2Notification* notification)
144
141
{
145
142
// Close custom notification.
146
143
@@ -155,9 +152,8 @@ void ScenarioNotificationReceived::NavigateToNotificationPage()
155
152
156
153
ScenarioNotificationReceived::~ScenarioNotificationReceived ()
157
154
{
158
- if (m_webView2Experimental22 )
155
+ if (m_webView2_24 )
159
156
{
160
- CHECK_FAILURE (
161
- m_webView2Experimental22->remove_NotificationReceived (m_notificationReceivedToken));
157
+ CHECK_FAILURE (m_webView2_24->remove_NotificationReceived (m_notificationReceivedToken));
162
158
}
163
159
}
0 commit comments