Backed out 8 changesets (bug 1901851, bug 1728331) for causing bc failures in browser...
[gecko.git] / toolkit / mozapps / defaultagent / Notification.h
blobe4e007088da40421ed8a9655772a0c82841fd37a
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__
10 #include <string>
12 #include "nsStringFwd.h"
14 namespace mozilla::default_agent {
16 enum class NotificationType {
17 Initial,
18 Followup,
21 enum class NotificationShown {
22 NotShown,
23 Shown,
24 Error,
27 enum class NotificationAction {
28 DismissedByTimeout,
29 DismissedToActionCenter,
30 DismissedByButton,
31 DismissedByApplicationHidden,
32 RemindMeLater,
33 MakeFirefoxDefaultButton,
34 ToastClicked,
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__