@@ -83,12 +83,13 @@ typedef winfoundtn::ITypedEventHandler<
83
83
ToastFailedHandler;
84
84
85
85
// Templated wrapper for winfoundtn::GetActivationFactory().
86
- template <unsigned int size, typename T>
87
- HRESULT CreateActivationFactory (wchar_t const (&class_name)[size], T** object) {
86
+ template <unsigned int size>
87
+ HRESULT CreateActivationFactory (wchar_t const (&class_name)[size],
88
+ const IID& iid,
89
+ void** factory) {
88
90
ScopedHString ref_class_name =
89
91
ScopedHString::Create (base::StringPiece16 (class_name, size - 1 ));
90
- return base::win::RoGetActivationFactory (ref_class_name.get (),
91
- IID_PPV_ARGS (object));
92
+ return base::win::RoGetActivationFactory (ref_class_name.get (), iid, factory);
92
93
}
93
94
94
95
void ForwardNotificationOperationOnUiThread (
@@ -180,7 +181,7 @@ class NotificationPlatformBridgeWinImpl
180
181
}
181
182
182
183
mswr::ComPtr<winxml::Dom::IXmlDocumentIO> document_io;
183
- hr = inspectable.As <winxml::Dom::IXmlDocumentIO> (&document_io);
184
+ hr = inspectable.As (&document_io);
184
185
if (FAILED (hr)) {
185
186
LogDisplayHistogram (
186
187
DisplayStatus::CONVERSION_FAILED_INSPECTABLE_TO_XML_IO);
@@ -210,7 +211,7 @@ class NotificationPlatformBridgeWinImpl
210
211
toast_notification_factory;
211
212
hr = CreateActivationFactory (
212
213
RuntimeClass_Windows_UI_Notifications_ToastNotification,
213
- toast_notification_factory. GetAddressOf ( ));
214
+ IID_PPV_ARGS (&toast_notification_factory ));
214
215
if (FAILED (hr)) {
215
216
LogDisplayHistogram (DisplayStatus::CREATE_FACTORY_FAILED);
216
217
DLOG (ERROR) << " Unable to create the IToastNotificationFactory "
@@ -220,7 +221,7 @@ class NotificationPlatformBridgeWinImpl
220
221
221
222
mswr::ComPtr<winui::Notifications::IToastNotification> toast_notification;
222
223
hr = toast_notification_factory->CreateToastNotification (
223
- document.Get (), toast_notification. GetAddressOf () );
224
+ document.Get (), & toast_notification);
224
225
if (FAILED (hr)) {
225
226
LogDisplayHistogram (DisplayStatus::CREATE_TOAST_NOTIFICATION_FAILED);
226
227
DLOG (ERROR) << " Unable to create the IToastNotification " << std::hex
@@ -436,7 +437,7 @@ class NotificationPlatformBridgeWinImpl
436
437
toast_manager;
437
438
HRESULT hr = CreateActivationFactory (
438
439
RuntimeClass_Windows_UI_Notifications_ToastNotificationManager,
439
- toast_manager. GetAddressOf ( ));
440
+ IID_PPV_ARGS (&toast_manager ));
440
441
if (FAILED (hr)) {
441
442
LogHistoryHistogram (
442
443
HistoryStatus::CREATE_TOAST_NOTIFICATION_MANAGER_FAILED);
@@ -447,9 +448,7 @@ class NotificationPlatformBridgeWinImpl
447
448
448
449
mswr::ComPtr<winui::Notifications::IToastNotificationManagerStatics2>
449
450
toast_manager2;
450
- hr = toast_manager
451
- .As <winui::Notifications::IToastNotificationManagerStatics2>(
452
- &toast_manager2);
451
+ hr = toast_manager.As (&toast_manager2);
453
452
if (FAILED (hr)) {
454
453
LogHistoryHistogram (
455
454
HistoryStatus::QUERY_TOAST_MANAGER_STATISTICS2_FAILED);
@@ -460,7 +459,7 @@ class NotificationPlatformBridgeWinImpl
460
459
461
460
mswr::ComPtr<winui::Notifications::IToastNotificationHistory>
462
461
notification_history;
463
- hr = toast_manager2->get_History (notification_history. GetAddressOf () );
462
+ hr = toast_manager2->get_History (& notification_history);
464
463
if (FAILED (hr)) {
465
464
LogHistoryHistogram (HistoryStatus::GET_TOAST_HISTORY_FAILED);
466
465
DLOG (ERROR) << " Failed to get IToastNotificationHistory " << std::hex
@@ -484,8 +483,7 @@ class NotificationPlatformBridgeWinImpl
484
483
}
485
484
486
485
mswr::ComPtr<winui::Notifications::IToastNotificationHistory2> history2;
487
- HRESULT hr =
488
- history.As <winui::Notifications::IToastNotificationHistory2>(&history2);
486
+ HRESULT hr = history.As (&history2);
489
487
if (FAILED (hr)) {
490
488
LogGetDisplayedStatus (
491
489
GetDisplayedStatus::QUERY_TOAST_NOTIFICATION_HISTORY2_FAILED);
@@ -779,7 +777,7 @@ class NotificationPlatformBridgeWinImpl
779
777
toast_manager;
780
778
HRESULT hr = CreateActivationFactory (
781
779
RuntimeClass_Windows_UI_Notifications_ToastNotificationManager,
782
- toast_manager. GetAddressOf ( ));
780
+ IID_PPV_ARGS (&toast_manager ));
783
781
if (FAILED (hr)) {
784
782
LogDisplayHistogram (
785
783
DisplayStatus::CREATE_TOAST_NOTIFICATION_MANAGER_FAILED);
0 commit comments