diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 9b548e70a7fa..62bcb8c2828b 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -161,17 +161,6 @@ ] }], # OS=="mac" ['OS=="win"', { - 'msvs_settings': { - 'VCLinkerTool': { - 'AdditionalDependencies': [ - # Windows Runtime. - 'crypt32.lib', - 'runtimeobject.lib', - 'shlwapi.lib', - 'windowsapp.lib', - ], - }, - }, 'conditions': [ ['libchromiumcontent_component', { # sandbox, base_static, devtools_discovery, devtools_http_handler, @@ -231,6 +220,9 @@ 'BluetoothApis.dll', 'Bthprops.cpl', 'setupapi.dll', + # windows runtime + 'API-MS-WIN-CORE-WINRT-L1-1-0.DLL', + 'API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL', ], }, }, diff --git a/brightray/browser/win/notification_presenter_win.cc b/brightray/browser/win/notification_presenter_win.cc index 9b981443dcbc..6fc4001a3396 100644 --- a/brightray/browser/win/notification_presenter_win.cc +++ b/brightray/browser/win/notification_presenter_win.cc @@ -14,11 +14,6 @@ #pragma comment(lib, "runtimeobject.lib") -using namespace Microsoft::WRL; -using namespace ABI::Windows::UI::Notifications; -using namespace ABI::Windows::Data::Xml::Dom; -using namespace ABI::Windows::Foundation; - namespace brightray { namespace { diff --git a/brightray/browser/win/windows_toast_notification.cc b/brightray/browser/win/windows_toast_notification.cc index cbeda90c360a..f2b155b3acfd 100644 --- a/brightray/browser/win/windows_toast_notification.cc +++ b/brightray/browser/win/windows_toast_notification.cc @@ -16,6 +16,7 @@ namespace brightray { namespace { // Initialize Windows Runtime + HRESULT init = Windows::Foundation::Initialize(RO_INIT_MULTITHREADED); } // namespace @@ -57,7 +58,7 @@ void WindowsToastNotification::ShowNotification( if (!toast_str.success()) return; - ComPtr toast_factory; + ComPtr toast_factory; if (FAILED(Windows::Foundation::GetActivationFactory(toast_str, &toast_factory))) return; @@ -90,24 +91,24 @@ void WindowsToastNotification::NotificationDismissed() { } bool WindowsToastNotification::GetToastXml( - IToastNotificationManagerStatics* toastManager, + ABI::Windows::UI::Notifications::IToastNotificationManagerStatics* toastManager, const std::wstring& title, const std::wstring& msg, std::string icon_path, IXmlDocument** toast_xml) { - ToastTemplateType template_type; + ABI::Windows::UI::Notifications::ToastTemplateType template_type; if (title.empty() || msg.empty()) { // Single line toast. - template_type = icon_path.empty() ? ToastTemplateType_ToastText01 : - ToastTemplateType_ToastImageAndText01; + template_type = icon_path.empty() ? ABI::Windows::UI::Notifications::ToastTemplateType_ToastText01 : + ABI::Windows::UI::Notifications::ToastTemplateType_ToastImageAndText01; if (FAILED(toast_manager_->GetTemplateContent(template_type, toast_xml))) return false; if (!SetXmlText(*toast_xml, title.empty() ? msg : title)) return false; } else { // Title and body toast. - template_type = icon_path.empty() ? ToastTemplateType_ToastText02 : - ToastTemplateType_ToastImageAndText02; + template_type = icon_path.empty() ? ABI::Windows::UI::Notifications::ToastTemplateType_ToastText02 : + ABI::Windows::UI::Notifications::ToastTemplateType_ToastImageAndText02; if (FAILED(toastManager->GetTemplateContent(template_type, toast_xml))) return false; if (!SetXmlText(*toast_xml, title, msg)) @@ -234,7 +235,7 @@ bool WindowsToastNotification::AppendTextToXml( return SUCCEEDED(node->AppendChild(text_node.Get(), &append_node)); } -bool WindowsToastNotification::SetupCallbacks(IToastNotification* toast) { +bool WindowsToastNotification::SetupCallbacks(ABI::Windows::UI::Notifications::IToastNotification* toast) { EventRegistrationToken activatedToken, dismissedToken; event_handler_ = Make(this); if (FAILED(toast->add_Activated(event_handler_.Get(), &activatedToken))) @@ -254,13 +255,14 @@ ToastEventHandler::~ToastEventHandler() { } IFACEMETHODIMP ToastEventHandler::Invoke( - IToastNotification* sender, IInspectable* args) { + ABI::Windows::UI::Notifications::IToastNotification* sender, IInspectable* args) { notification_->NotificationClicked(); return S_OK; } IFACEMETHODIMP ToastEventHandler::Invoke( - IToastNotification* sender, IToastDismissedEventArgs* e) { + ABI::Windows::UI::Notifications::IToastNotification* sender, + ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) { notification_->NotificationDismissed(); return S_OK; } diff --git a/brightray/browser/win/windows_toast_notification.h b/brightray/browser/win/windows_toast_notification.h index bab6612c9f3e..8a24e44af29f 100644 --- a/brightray/browser/win/windows_toast_notification.h +++ b/brightray/browser/win/windows_toast_notification.h @@ -16,17 +16,17 @@ #include "content/public/common/platform_notification_data.h" using namespace Microsoft::WRL; -using namespace ABI::Windows::UI::Notifications; -using namespace ABI::Windows::Foundation; class ScopedHString; namespace brightray { using DesktopToastActivatedEventHandler = - ITypedEventHandler; + ABI::Windows::Foundation::ITypedEventHandler; using DesktopToastDismissedEventHandler = - ITypedEventHandler; + ABI::Windows::Foundation::ITypedEventHandler; class WindowsToastNotification { public: @@ -50,7 +50,7 @@ class WindowsToastNotification { void NotificationClicked(); void NotificationDismissed(); - bool GetToastXml(IToastNotificationManagerStatics* toastManager, + bool GetToastXml(ABI::Windows::UI::Notifications::IToastNotificationManagerStatics* toastManager, const std::wstring& title, const std::wstring& msg, std::string icon_path, @@ -69,13 +69,13 @@ class WindowsToastNotification { bool AppendTextToXml(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc, ABI::Windows::Data::Xml::Dom::IXmlNode* node, const std::wstring& text); - bool SetupCallbacks(IToastNotification* toast); + bool SetupCallbacks(ABI::Windows::UI::Notifications::IToastNotification* toast); scoped_ptr delegate_; ComPtr event_handler_; - ComPtr toast_manager_; - ComPtr toast_notifier_; - ComPtr toast_notification_; + ComPtr toast_manager_; + ComPtr toast_notifier_; + ComPtr toast_notification_; base::WeakPtrFactory weak_factory_; @@ -90,8 +90,8 @@ class ToastEventHandler : public RuntimeClass, ToastEventHandler(WindowsToastNotification* notification); ~ToastEventHandler(); - IFACEMETHODIMP Invoke(IToastNotification* sender, IInspectable* args); - IFACEMETHODIMP Invoke(IToastNotification* sender, IToastDismissedEventArgs* e); + IFACEMETHODIMP Invoke(ABI::Windows::UI::Notifications::IToastNotification* sender, IInspectable* args); + IFACEMETHODIMP Invoke(ABI::Windows::UI::Notifications::IToastNotification* sender, ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e); private: WindowsToastNotification* notification_; // weak ref.