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 "DefaultBrowser.h"
12 namespace mozilla::default_agent
{
14 enum class NotificationType
{
19 enum class NotificationShown
{
25 enum class NotificationAction
{
27 DismissedToActionCenter
,
29 DismissedByApplicationHidden
,
31 MakeFirefoxDefaultButton
,
33 NoAction
, // Should not be used with NotificationShown::Shown
36 struct NotificationActivities
{
37 NotificationType type
;
38 NotificationShown shown
;
39 NotificationAction action
;
42 NotificationActivities
MaybeShowNotification(
43 const DefaultBrowserInfo
& browserInfo
, const wchar_t* aumi
, bool force
);
45 // These take enum values and get strings suitable for telemetry
46 std::string
GetStringForNotificationType(NotificationType type
);
47 std::string
GetStringForNotificationShown(NotificationShown shown
);
48 NotificationShown
GetNotificationShownFromString(const nsAString
& shown
);
49 std::string
GetStringForNotificationAction(NotificationAction action
);
50 NotificationAction
GetNotificationActionFromString(const nsAString
& action
);
52 // If actionString is a valid action string (i.e. corresponds to one of the
53 // NotificationAction values), this function has no effect. If actionString is
54 // not a valid action string, its value will be replaced with the string for
55 // NotificationAction::NoAction.
56 void EnsureValidNotificationAction(std::string
& actionString
);
58 } // namespace mozilla::default_agent
60 #endif // __DEFAULT_BROWSER_NOTIFICATION_H__