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 #ifndef CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_ |
6 #define CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_ | 6 #define CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 // Structure representing the information associated with a Web Notification. | 17 // Structure representing the information associated with a Web Notification. |
17 // This struct should include the developer-visible information, kept | 18 // This struct should include the developer-visible information, kept |
18 // synchronized with the WebNotificationData structure defined in the Blink API. | 19 // synchronized with the WebNotificationData structure defined in the Blink API. |
19 struct CONTENT_EXPORT PlatformNotificationData { | 20 struct CONTENT_EXPORT PlatformNotificationData { |
20 PlatformNotificationData(); | 21 PlatformNotificationData(); |
21 ~PlatformNotificationData(); | 22 ~PlatformNotificationData(); |
22 | 23 |
| 24 // The maximum size of developer-provided data to be stored in the |data| |
| 25 // property of this structure. |
| 26 static const size_t kMaximumDeveloperDataSize = 1024 * 1024; |
| 27 |
23 enum NotificationDirection { | 28 enum NotificationDirection { |
24 NotificationDirectionLeftToRight, | 29 NotificationDirectionLeftToRight, |
25 NotificationDirectionRightToLeft, | 30 NotificationDirectionRightToLeft, |
26 | 31 |
27 NotificationDirectionLast = NotificationDirectionRightToLeft | 32 NotificationDirectionLast = NotificationDirectionRightToLeft |
28 }; | 33 }; |
29 | 34 |
30 // Title to be displayed with the Web Notification. | 35 // Title to be displayed with the Web Notification. |
31 base::string16 title; | 36 base::string16 title; |
32 | 37 |
33 // Hint to determine the directionality of the displayed notification. | 38 // Hint to determine the directionality of the displayed notification. |
34 NotificationDirection direction; | 39 NotificationDirection direction = NotificationDirectionLeftToRight; |
35 | 40 |
36 // BCP 47 language tag describing the notification's contents. Optional. | 41 // BCP 47 language tag describing the notification's contents. Optional. |
37 std::string lang; | 42 std::string lang; |
38 | 43 |
39 // Contents of the notification. | 44 // Contents of the notification. |
40 base::string16 body; | 45 base::string16 body; |
41 | 46 |
42 // Tag of the notification. Notifications sharing both their origin and their | 47 // Tag of the notification. Notifications sharing both their origin and their |
43 // tag will replace the first displayed notification. | 48 // tag will replace the first displayed notification. |
44 std::string tag; | 49 std::string tag; |
45 | 50 |
46 // URL of the icon which is to be displayed with the notification. | 51 // URL of the icon which is to be displayed with the notification. |
47 GURL icon; | 52 GURL icon; |
48 | 53 |
49 // Whether default notification indicators (sound, vibration, light) should | 54 // Whether default notification indicators (sound, vibration, light) should |
50 // be suppressed. | 55 // be suppressed. |
51 bool silent; | 56 bool silent = false; |
| 57 |
| 58 // Developer-provided data associated with the notification, in the form of |
| 59 // a serialized string. Must not exceed |kMaximumDeveloperDataSize| bytes. |
| 60 std::vector<char> data; |
52 }; | 61 }; |
53 | 62 |
54 } // namespace content | 63 } // namespace content |
55 | 64 |
56 #endif // CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_ | 65 #endif // CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_ |
OLD | NEW |