Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / common / platform_notification_messages.h
blobf21713fa282b19b03bf0224e4e94b761c8fc0416
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.
5 // Messages for platform-native notifications using the Web Notification API.
6 // Multiply-included message file, hence no include guard.
8 #include <stdint.h>
9 #include <string>
10 #include <utility>
11 #include <vector>
13 #include "content/public/common/platform_notification_data.h"
14 #include "ipc/ipc_message_macros.h"
15 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificationPermission.h"
16 #include "third_party/skia/include/core/SkBitmap.h"
18 // Singly-included section for type definitions.
19 #ifndef CONTENT_COMMON_PLATFORM_NOTIFICATION_MESSAGES_H_
20 #define CONTENT_COMMON_PLATFORM_NOTIFICATION_MESSAGES_H_
22 // Defines the pair of [persistent notification id] => [notification data] used
23 // when getting the notifications for a given Service Worker registration.
24 using PersistentNotificationInfo =
25 std::pair<int64_t, content::PlatformNotificationData>;
27 #endif // CONTENT_COMMON_PLATFORM_NOTIFICATION_MESSAGES_H_
29 #define IPC_MESSAGE_START PlatformNotificationMsgStart
31 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebNotificationPermission,
32 blink::WebNotificationPermissionLast)
34 IPC_ENUM_TRAITS_MAX_VALUE(
35 content::PlatformNotificationData::NotificationDirection,
36 content::PlatformNotificationData::NotificationDirectionLast)
38 IPC_STRUCT_TRAITS_BEGIN(content::PlatformNotificationData)
39 IPC_STRUCT_TRAITS_MEMBER(title)
40 IPC_STRUCT_TRAITS_MEMBER(direction)
41 IPC_STRUCT_TRAITS_MEMBER(lang)
42 IPC_STRUCT_TRAITS_MEMBER(body)
43 IPC_STRUCT_TRAITS_MEMBER(tag)
44 IPC_STRUCT_TRAITS_MEMBER(icon)
45 IPC_STRUCT_TRAITS_MEMBER(silent)
46 IPC_STRUCT_TRAITS_MEMBER(data)
47 IPC_STRUCT_TRAITS_END()
49 // Messages sent from the browser to the renderer.
51 // Informs the renderer that the browser has displayed the notification.
52 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidShow,
53 int /* notification_id */)
55 // Informs the renderer that the notification has been closed.
56 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidClose,
57 int /* notification_id */)
59 // Informs the renderer that the notification has been clicked on.
60 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidClick,
61 int /* notification_id */)
63 // Reply to PlatformNotificationHostMsg_ShowPersistent indicating that a
64 // persistent notification has been shown on the platform (if |success| is
65 // true), or that an unspecified error occurred.
66 IPC_MESSAGE_CONTROL2(PlatformNotificationMsg_DidShowPersistent,
67 int /* request_id */,
68 bool /* success */)
70 // Reply to PlatformNotificationHostMsg_GetNotifications sharing a vector of
71 // available notifications per the request's constraints.
72 IPC_MESSAGE_CONTROL2(PlatformNotificationMsg_DidGetNotifications,
73 int /* request_id */,
74 std::vector<PersistentNotificationInfo>
75 /* notifications */)
77 // Messages sent from the renderer to the browser.
79 IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_Show,
80 int /* notification_id */,
81 GURL /* origin */,
82 SkBitmap /* icon */,
83 content::PlatformNotificationData /* notification_data */)
85 IPC_MESSAGE_CONTROL5(PlatformNotificationHostMsg_ShowPersistent,
86 int /* request_id */,
87 int64_t /* service_worker_registration_id */,
88 GURL /* origin */,
89 SkBitmap /* icon */,
90 content::PlatformNotificationData /* notification_data */)
92 IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_GetNotifications,
93 int /* request_id */,
94 int64_t /* service_worker_registration_id */,
95 GURL /* origin */,
96 std::string /* filter_tag */)
98 IPC_MESSAGE_CONTROL1(PlatformNotificationHostMsg_Close,
99 int /* notification_id */)
101 IPC_MESSAGE_CONTROL2(PlatformNotificationHostMsg_ClosePersistent,
102 GURL /* origin */,
103 int64_t /* persistent_notification_id */)
105 IPC_SYNC_MESSAGE_CONTROL1_1(PlatformNotificationHostMsg_CheckPermission,
106 GURL /* origin */,
107 blink::WebNotificationPermission /* result */)