Backed out 3 changesets (bug 1883476, bug 1826375) for causing windows build bustages...
[gecko.git] / toolkit / mozapps / defaultagent / Notification.h
blob210c55f55947e90a8b52eb1f821a2b06f17af1d8
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 {
15 Initial,
16 Followup,
19 enum class NotificationShown {
20 NotShown,
21 Shown,
22 Error,
25 enum class NotificationAction {
26 DismissedByTimeout,
27 DismissedToActionCenter,
28 DismissedByButton,
29 DismissedByApplicationHidden,
30 RemindMeLater,
31 MakeFirefoxDefaultButton,
32 ToastClicked,
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__