1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef __DEFAULT_BROWSER_NOTIFICATION_H__
8 #define __DEFAULT_BROWSER_NOTIFICATION_H__
12 #include "nsStringFwd.h"
14 namespace mozilla::default_agent
{
16 enum class NotificationType
{
21 enum class NotificationShown
{
27 enum class NotificationAction
{
29 DismissedToActionCenter
,
31 DismissedByApplicationHidden
,
33 MakeFirefoxDefaultButton
,
35 NoAction
, // Should not be used with NotificationShown::Shown
38 struct NotificationActivities
{
39 NotificationType type
;
40 NotificationShown shown
;
41 NotificationAction action
;
44 // These take enum values and get strings suitable for telemetry
45 std::string
GetStringForNotificationType(NotificationType type
);
46 std::string
GetStringForNotificationShown(NotificationShown shown
);
47 NotificationShown
GetNotificationShownFromString(const nsAString
& shown
);
48 std::string
GetStringForNotificationAction(NotificationAction action
);
49 NotificationAction
GetNotificationActionFromString(const nsAString
& action
);
51 // If actionString is a valid action string (i.e. corresponds to one of the
52 // NotificationAction values), this function has no effect. If actionString is
53 // not a valid action string, its value will be replaced with the string for
54 // NotificationAction::NoAction.
55 void EnsureValidNotificationAction(std::string
& actionString
);
57 } // namespace mozilla::default_agent
59 #endif // __DEFAULT_BROWSER_NOTIFICATION_H__