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 #ifndef CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_
6 #define CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_
11 #include "base/strings/string16.h"
12 #include "content/common/content_export.h"
17 // A notification action (button); corresponds to Blink WebNotificationAction.
18 struct CONTENT_EXPORT PlatformNotificationAction
{
19 PlatformNotificationAction();
20 ~PlatformNotificationAction();
22 // Action name that the author can use to distinguish them.
25 // Title of the button.
29 // Structure representing the information associated with a Web Notification.
30 // This struct should include the developer-visible information, kept
31 // synchronized with the WebNotificationData structure defined in the Blink API.
32 struct CONTENT_EXPORT PlatformNotificationData
{
33 PlatformNotificationData();
34 ~PlatformNotificationData();
36 // The maximum size of developer-provided data to be stored in the |data|
37 // property of this structure.
38 static const size_t kMaximumDeveloperDataSize
= 1024 * 1024;
41 DIRECTION_LEFT_TO_RIGHT
,
42 DIRECTION_RIGHT_TO_LEFT
,
45 DIRECTION_LAST
= DIRECTION_AUTO
48 // Title to be displayed with the Web Notification.
51 // Hint to determine the directionality of the displayed notification.
52 Direction direction
= DIRECTION_LEFT_TO_RIGHT
;
54 // BCP 47 language tag describing the notification's contents. Optional.
57 // Contents of the notification.
60 // Tag of the notification. Notifications sharing both their origin and their
61 // tag will replace the first displayed notification.
64 // URL of the icon which is to be displayed with the notification.
67 // Vibration pattern for the notification, following the syntax of the
68 // Vibration API. https://www.w3.org/TR/vibration/
69 std::vector
<int> vibration_pattern
;
71 // Whether default notification indicators (sound, vibration, light) should
75 // Developer-provided data associated with the notification, in the form of
76 // a serialized string. Must not exceed |kMaximumDeveloperDataSize| bytes.
77 std::vector
<char> data
;
79 // Actions that should be shown as buttons on the notification.
80 std::vector
<PlatformNotificationAction
> actions
;
83 } // namespace content
85 #endif // CONTENT_PUBLIC_COMMON_PLATFORM_NOTIFICATION_DATA_H_