| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Messages for platform-native notifications using the Web Notification API. | |
| 6 // Multiply-included message file, hence no include guard. | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 #include <string> | |
| 10 #include <utility> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "content/public/common/common_param_traits_macros.h" | |
| 14 #include "content/public/common/notification_resources.h" | |
| 15 #include "content/public/common/platform_notification_data.h" | |
| 16 #include "ipc/ipc_message_macros.h" | |
| 17 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" | |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | |
| 19 | |
| 20 // Singly-included section for type definitions. | |
| 21 #ifndef CONTENT_COMMON_PLATFORM_NOTIFICATION_MESSAGES_H_ | |
| 22 #define CONTENT_COMMON_PLATFORM_NOTIFICATION_MESSAGES_H_ | |
| 23 | |
| 24 // Defines the pair of [persistent notification id] => [notification data] used | |
| 25 // when getting the notifications for a given Service Worker registration. | |
| 26 using PersistentNotificationInfo = | |
| 27 std::pair<int64_t, content::PlatformNotificationData>; | |
| 28 | |
| 29 #endif // CONTENT_COMMON_PLATFORM_NOTIFICATION_MESSAGES_H_ | |
| 30 | |
| 31 #define IPC_MESSAGE_START PlatformNotificationMsgStart | |
| 32 | |
| 33 IPC_ENUM_TRAITS_MAX_VALUE( | |
| 34 content::PlatformNotificationData::Direction, | |
| 35 content::PlatformNotificationData::DIRECTION_LAST) | |
| 36 | |
| 37 IPC_ENUM_TRAITS_MAX_VALUE(content::PlatformNotificationActionType, | |
| 38 content::PLATFORM_NOTIFICATION_ACTION_TYPE_TEXT) | |
| 39 | |
| 40 IPC_STRUCT_TRAITS_BEGIN(content::PlatformNotificationAction) | |
| 41 IPC_STRUCT_TRAITS_MEMBER(type) | |
| 42 IPC_STRUCT_TRAITS_MEMBER(action) | |
| 43 IPC_STRUCT_TRAITS_MEMBER(title) | |
| 44 IPC_STRUCT_TRAITS_MEMBER(icon) | |
| 45 IPC_STRUCT_TRAITS_MEMBER(placeholder) | |
| 46 IPC_STRUCT_TRAITS_END() | |
| 47 | |
| 48 IPC_STRUCT_TRAITS_BEGIN(content::PlatformNotificationData) | |
| 49 IPC_STRUCT_TRAITS_MEMBER(title) | |
| 50 IPC_STRUCT_TRAITS_MEMBER(direction) | |
| 51 IPC_STRUCT_TRAITS_MEMBER(lang) | |
| 52 IPC_STRUCT_TRAITS_MEMBER(body) | |
| 53 IPC_STRUCT_TRAITS_MEMBER(tag) | |
| 54 IPC_STRUCT_TRAITS_MEMBER(icon) | |
| 55 IPC_STRUCT_TRAITS_MEMBER(badge) | |
| 56 IPC_STRUCT_TRAITS_MEMBER(vibration_pattern) | |
| 57 IPC_STRUCT_TRAITS_MEMBER(timestamp) | |
| 58 IPC_STRUCT_TRAITS_MEMBER(renotify) | |
| 59 IPC_STRUCT_TRAITS_MEMBER(silent) | |
| 60 IPC_STRUCT_TRAITS_MEMBER(require_interaction) | |
| 61 IPC_STRUCT_TRAITS_MEMBER(data) | |
| 62 IPC_STRUCT_TRAITS_MEMBER(actions) | |
| 63 IPC_STRUCT_TRAITS_END() | |
| 64 | |
| 65 IPC_STRUCT_TRAITS_BEGIN(content::NotificationResources) | |
| 66 IPC_STRUCT_TRAITS_MEMBER(notification_icon) | |
| 67 IPC_STRUCT_TRAITS_MEMBER(badge) | |
| 68 IPC_STRUCT_TRAITS_MEMBER(action_icons) | |
| 69 IPC_STRUCT_TRAITS_END() | |
| 70 | |
| 71 // Messages sent from the browser to the renderer. | |
| 72 | |
| 73 // Informs the renderer that the browser has displayed the notification. | |
| 74 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidShow, | |
| 75 int /* notification_id */) | |
| 76 | |
| 77 // Informs the renderer that the notification has been closed. | |
| 78 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidClose, | |
| 79 int /* notification_id */) | |
| 80 | |
| 81 // Informs the renderer that the notification has been clicked on. | |
| 82 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidClick, | |
| 83 int /* notification_id */) | |
| 84 | |
| 85 // Reply to PlatformNotificationHostMsg_ShowPersistent indicating that a | |
| 86 // persistent notification has been shown on the platform (if |success| is | |
| 87 // true), or that an unspecified error occurred. | |
| 88 IPC_MESSAGE_CONTROL2(PlatformNotificationMsg_DidShowPersistent, | |
| 89 int /* request_id */, | |
| 90 bool /* success */) | |
| 91 | |
| 92 // Reply to PlatformNotificationHostMsg_GetNotifications sharing a vector of | |
| 93 // available notifications per the request's constraints. | |
| 94 IPC_MESSAGE_CONTROL2(PlatformNotificationMsg_DidGetNotifications, | |
| 95 int /* request_id */, | |
| 96 std::vector<PersistentNotificationInfo> | |
| 97 /* notifications */) | |
| 98 | |
| 99 // Messages sent from the renderer to the browser. | |
| 100 | |
| 101 IPC_MESSAGE_CONTROL4( | |
| 102 PlatformNotificationHostMsg_Show, | |
| 103 int /* notification_id */, | |
| 104 GURL /* origin */, | |
| 105 content::PlatformNotificationData /* notification_data */, | |
| 106 content::NotificationResources /* notification_resources */) | |
| 107 | |
| 108 IPC_MESSAGE_CONTROL5( | |
| 109 PlatformNotificationHostMsg_ShowPersistent, | |
| 110 int /* request_id */, | |
| 111 int64_t /* service_worker_registration_id */, | |
| 112 GURL /* origin */, | |
| 113 content::PlatformNotificationData /* notification_data */, | |
| 114 content::NotificationResources /* notification_resources */) | |
| 115 | |
| 116 IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_GetNotifications, | |
| 117 int /* request_id */, | |
| 118 int64_t /* service_worker_registration_id */, | |
| 119 GURL /* origin */, | |
| 120 std::string /* filter_tag */) | |
| 121 | |
| 122 IPC_MESSAGE_CONTROL1(PlatformNotificationHostMsg_Close, | |
| 123 int /* notification_id */) | |
| 124 | |
| 125 IPC_MESSAGE_CONTROL2(PlatformNotificationHostMsg_ClosePersistent, | |
| 126 GURL /* origin */, | |
| 127 int64_t /* persistent_notification_id */) | |
| 128 | |
| 129 IPC_SYNC_MESSAGE_CONTROL1_1( | |
| 130 PlatformNotificationHostMsg_CheckPermission, | |
| 131 GURL /* origin */, | |
| 132 blink::mojom::PermissionStatus /* permission_status */) | |
| OLD | NEW |