Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 // Messages for platform-native notifications using the Web Notification API. | 5 // Messages for platform-native notifications using the Web Notification API. |
| 6 // Multiply-included message file, hence no include guard. | 6 // Multiply-included message file, hence no include guard. |
| 7 | 7 |
| 8 #include <stdint.h> | |
| 9 #include <string> | |
| 10 #include <utility> | |
| 11 #include <vector> | |
| 12 | |
| 8 #include "content/public/common/platform_notification_data.h" | 13 #include "content/public/common/platform_notification_data.h" |
| 9 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
| 10 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onPermission.h" | 15 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onPermission.h" |
| 11 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 | 17 |
| 13 #define IPC_MESSAGE_START PlatformNotificationMsgStart | 18 #define IPC_MESSAGE_START PlatformNotificationMsgStart |
| 14 | 19 |
| 15 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebNotificationPermission, | 20 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebNotificationPermission, |
| 16 blink::WebNotificationPermissionLast) | 21 blink::WebNotificationPermissionLast) |
| 17 | 22 |
| 18 IPC_ENUM_TRAITS_MAX_VALUE( | 23 IPC_ENUM_TRAITS_MAX_VALUE( |
| 19 content::PlatformNotificationData::NotificationDirection, | 24 content::PlatformNotificationData::NotificationDirection, |
| 20 content::PlatformNotificationData::NotificationDirectionLast) | 25 content::PlatformNotificationData::NotificationDirectionLast) |
| 21 | 26 |
| 22 IPC_STRUCT_TRAITS_BEGIN(content::PlatformNotificationData) | 27 IPC_STRUCT_TRAITS_BEGIN(content::PlatformNotificationData) |
| 23 IPC_STRUCT_TRAITS_MEMBER(title) | 28 IPC_STRUCT_TRAITS_MEMBER(title) |
| 24 IPC_STRUCT_TRAITS_MEMBER(direction) | 29 IPC_STRUCT_TRAITS_MEMBER(direction) |
| 25 IPC_STRUCT_TRAITS_MEMBER(lang) | 30 IPC_STRUCT_TRAITS_MEMBER(lang) |
| 26 IPC_STRUCT_TRAITS_MEMBER(body) | 31 IPC_STRUCT_TRAITS_MEMBER(body) |
| 27 IPC_STRUCT_TRAITS_MEMBER(tag) | 32 IPC_STRUCT_TRAITS_MEMBER(tag) |
| 28 IPC_STRUCT_TRAITS_MEMBER(icon) | 33 IPC_STRUCT_TRAITS_MEMBER(icon) |
| 29 IPC_STRUCT_TRAITS_MEMBER(silent) | 34 IPC_STRUCT_TRAITS_MEMBER(silent) |
| 30 IPC_STRUCT_TRAITS_END() | 35 IPC_STRUCT_TRAITS_END() |
| 31 | 36 |
| 37 // Defines the pair of [persistent notification id] => [notification data] used | |
| 38 // when getting the notifications for a given Service Worker registration. | |
| 39 using PersistentNotificationInfo = | |
|
Tom Sepez
2015/03/17 21:32:38
This will have to move to an include guarded secti
Peter Beverloo
2015/03/19 15:46:44
Done.
| |
| 40 std::pair<std::string, content::PlatformNotificationData>; | |
| 41 | |
| 32 // Messages sent from the browser to the renderer. | 42 // Messages sent from the browser to the renderer. |
| 33 | 43 |
| 34 // Informs the renderer that the browser has displayed the notification. | 44 // Informs the renderer that the browser has displayed the notification. |
| 35 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidShow, | 45 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidShow, |
| 36 int /* notification_id */) | 46 int /* notification_id */) |
| 37 | 47 |
| 38 // Informs the renderer that the notification has been closed. | 48 // Informs the renderer that the notification has been closed. |
| 39 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidClose, | 49 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidClose, |
| 40 int /* notification_id */) | 50 int /* notification_id */) |
| 41 | 51 |
| 42 // Informs the renderer that the notification has been clicked on. | 52 // Informs the renderer that the notification has been clicked on. |
| 43 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidClick, | 53 IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidClick, |
| 44 int /* notification_id */) | 54 int /* notification_id */) |
| 45 | 55 |
| 56 // Informs the renderer about a vector of available notifications in response | |
|
Tom Sepez
2015/03/17 21:32:38
nit: this comment might indicate
"reply to Platfo
Peter Beverloo
2015/03/19 15:46:44
Done.
| |
| 57 // to a request to get all persistent notifications for a Service Worker. | |
| 58 IPC_MESSAGE_CONTROL2(PlatformNotificationMsg_DidGetNotifications, | |
| 59 int /* request_id */, | |
| 60 std::vector<PersistentNotificationInfo> | |
| 61 /* notifications */) | |
| 62 | |
| 46 // Messages sent from the renderer to the browser. | 63 // Messages sent from the renderer to the browser. |
| 47 | 64 |
| 48 IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_Show, | 65 IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_Show, |
| 49 int /* notification_id */, | 66 int /* notification_id */, |
| 50 GURL /* origin */, | 67 GURL /* origin */, |
| 51 SkBitmap /* icon */, | 68 SkBitmap /* icon */, |
| 52 content::PlatformNotificationData /* notification_data */) | 69 content::PlatformNotificationData /* notification_data */) |
| 53 | 70 |
| 54 IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_ShowPersistent, | 71 IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_ShowPersistent, |
| 55 int64 /* service_worker_provider_id */, | 72 int64_t /* service_worker_registration_id */, |
| 56 GURL /* origin */, | 73 GURL /* origin */, |
| 57 SkBitmap /* icon */, | 74 SkBitmap /* icon */, |
| 58 content::PlatformNotificationData /* notification_data */) | 75 content::PlatformNotificationData /* notification_data */) |
| 59 | 76 |
| 77 IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_GetNotifications, | |
| 78 int /* request_id */, | |
| 79 int64_t /* service_worker_registration_id */, | |
| 80 GURL /* origin */, | |
| 81 std::string /* filter_tag */) | |
| 82 | |
| 60 IPC_MESSAGE_CONTROL1(PlatformNotificationHostMsg_Close, | 83 IPC_MESSAGE_CONTROL1(PlatformNotificationHostMsg_Close, |
| 61 int /* notification_id */) | 84 int /* notification_id */) |
| 62 | 85 |
| 63 IPC_MESSAGE_CONTROL2(PlatformNotificationHostMsg_ClosePersistent, | 86 IPC_MESSAGE_CONTROL2(PlatformNotificationHostMsg_ClosePersistent, |
| 64 GURL /* origin */, | 87 GURL /* origin */, |
| 65 std::string /* persistent_notification_id */) | 88 std::string /* persistent_notification_id */) |
| 66 | 89 |
| 67 IPC_SYNC_MESSAGE_CONTROL1_1(PlatformNotificationHostMsg_CheckPermission, | 90 IPC_SYNC_MESSAGE_CONTROL1_1(PlatformNotificationHostMsg_CheckPermission, |
| 68 GURL /* origin */, | 91 GURL /* origin */, |
| 69 blink::WebNotificationPermission /* result */) | 92 blink::WebNotificationPermission /* result */) |
| OLD | NEW |