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 #include <vector> |
10 | 10 |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
| 17 // A notification action (button); corresponds to Blink WebNotificationAction. |
| 18 struct CONTENT_EXPORT PlatformNotificationAction { |
| 19 PlatformNotificationAction(); |
| 20 ~PlatformNotificationAction(); |
| 21 |
| 22 // Action name that the author can use to distinguish them. |
| 23 std::string action; |
| 24 |
| 25 // Title of the button. |
| 26 base::string16 title; |
| 27 }; |
| 28 |
17 // Structure representing the information associated with a Web Notification. | 29 // Structure representing the information associated with a Web Notification. |
18 // This struct should include the developer-visible information, kept | 30 // This struct should include the developer-visible information, kept |
19 // synchronized with the WebNotificationData structure defined in the Blink API. | 31 // synchronized with the WebNotificationData structure defined in the Blink API. |
20 struct CONTENT_EXPORT PlatformNotificationData { | 32 struct CONTENT_EXPORT PlatformNotificationData { |
21 PlatformNotificationData(); | 33 PlatformNotificationData(); |
22 ~PlatformNotificationData(); | 34 ~PlatformNotificationData(); |
23 | 35 |
24 // The maximum size of developer-provided data to be stored in the |data| | 36 // The maximum size of developer-provided data to be stored in the |data| |
25 // property of this structure. | 37 // property of this structure. |
26 static const size_t kMaximumDeveloperDataSize = 1024 * 1024; | 38 static const size_t kMaximumDeveloperDataSize = 1024 * 1024; |
(...skipping 28 matching lines...) Expand all Loading... |
55 // Vibration API. https://www.w3.org/TR/vibration/ | 67 // Vibration API. https://www.w3.org/TR/vibration/ |
56 std::vector<int> vibration_pattern; | 68 std::vector<int> vibration_pattern; |
57 | 69 |
58 // Whether default notification indicators (sound, vibration, light) should | 70 // Whether default notification indicators (sound, vibration, light) should |
59 // be suppressed. | 71 // be suppressed. |
60 bool silent = false; | 72 bool silent = false; |
61 | 73 |
62 // Developer-provided data associated with the notification, in the form of | 74 // Developer-provided data associated with the notification, in the form of |
63 // a serialized string. Must not exceed |kMaximumDeveloperDataSize| bytes. | 75 // a serialized string. Must not exceed |kMaximumDeveloperDataSize| bytes. |
64 std::vector<char> data; | 76 std::vector<char> data; |
| 77 |
| 78 // Actions that should be shown as buttons on the notification. |
| 79 std::vector<PlatformNotificationAction> actions; |
65 }; | 80 }; |
66 | 81 |
67 } // namespace content | 82 } // namespace content |
68 | 83 |
69 #endif // CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_ | 84 #endif // CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_ |
OLD | NEW |