| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_TOAST_NOTIFICATION_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_TOAST_NOTIFICATION_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_METRO_DRIVER_TOAST_NOTIFICATION_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_METRO_DRIVER_TOAST_NOTIFICATION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <windows.ui.notifications.h> | 8 #include <windows.ui.notifications.h> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/win/metro.h" |
| 11 | 12 |
| 12 // Provides functionality to display a metro style toast notification. | 13 // Provides functionality to display a metro style toast notification. |
| 13 class ToastNotificationHandler { | 14 class ToastNotificationHandler { |
| 14 public: | 15 public: |
| 15 // Holds information about a desktop notification to be displayed. | 16 // Holds information about a desktop notification to be displayed. |
| 16 struct DesktopNotification { | 17 struct DesktopNotification { |
| 17 std::string origin_url; | 18 std::string origin_url; |
| 18 std::string icon_url; | 19 std::string icon_url; |
| 19 string16 title; | 20 string16 title; |
| 20 string16 body; | 21 string16 body; |
| 21 string16 display_source; | 22 string16 display_source; |
| 22 std::string id; | 23 std::string id; |
| 24 base::win::MetroNotificationClickedHandler notification_handler; |
| 25 string16 notification_context; |
| 23 | 26 |
| 24 DesktopNotification(const char* notification_origin, | 27 DesktopNotification(const char* notification_origin, |
| 25 const char* notification_icon, | 28 const char* notification_icon, |
| 26 const wchar_t* notification_title, | 29 const wchar_t* notification_title, |
| 27 const wchar_t* notification_body, | 30 const wchar_t* notification_body, |
| 28 const wchar_t* notification_display_source, | 31 const wchar_t* notification_display_source, |
| 29 const char* notification_id); | 32 const char* notification_id, |
| 33 base::win::MetroNotificationClickedHandler handler, |
| 34 const wchar_t* handler_context); |
| 35 |
| 36 DesktopNotification(); |
| 30 }; | 37 }; |
| 31 | 38 |
| 32 ToastNotificationHandler(); | 39 ToastNotificationHandler(); |
| 33 ~ToastNotificationHandler(); | 40 ~ToastNotificationHandler(); |
| 34 | 41 |
| 35 void DisplayNotification(const DesktopNotification& notification); | 42 void DisplayNotification(const DesktopNotification& notification); |
| 36 void CancelNotification(); | 43 void CancelNotification(); |
| 37 | 44 |
| 38 HRESULT OnActivate(winui::Notifications::IToastNotification* notification, | 45 HRESULT OnActivate(winui::Notifications::IToastNotification* notification, |
| 39 IInspectable* inspectable); | 46 IInspectable* inspectable); |
| 40 | 47 |
| 41 private: | 48 private: |
| 42 mswr::ComPtr<winui::Notifications::IToastNotifier> notifier_; | 49 mswr::ComPtr<winui::Notifications::IToastNotifier> notifier_; |
| 43 mswr::ComPtr<winui::Notifications::IToastNotification> notification_; | 50 mswr::ComPtr<winui::Notifications::IToastNotification> notification_; |
| 44 | |
| 45 EventRegistrationToken activated_token_; | 51 EventRegistrationToken activated_token_; |
| 52 DesktopNotification notification_info_; |
| 46 }; | 53 }; |
| 47 | 54 |
| 48 #endif // CHROME_BROWSER_UI_METRO_DRIVER_TOAST_NOTIFICATION_HANDLER_H_ | 55 #endif // CHROME_BROWSER_UI_METRO_DRIVER_TOAST_NOTIFICATION_HANDLER_H_ |
| OLD | NEW |