Bug 1880227 - Migrate Focus docs into Sphinx. r=owlish,geckoview-reviewers,android...
[gecko.git] / widget / cocoa / OSXNotificationCenter.h
blob65025d04abb55d0e124ec31f67067260fa0546ee
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef OSXNotificationCenter_h
7 #define OSXNotificationCenter_h
9 #import <Foundation/Foundation.h>
10 #include "nsIAlertsService.h"
11 #include "nsTArray.h"
12 #include "mozilla/RefPtr.h"
14 // mozNotificationCenterDelegate is used to access the macOS notification
15 // center. It is not related to the DesktopNotificationCenter object, which was
16 // removed in bug 952453. While there are no direct references to this class
17 // elsewhere, removing this will cause push notifications on macOS to stop
18 // working.
19 @class mozNotificationCenterDelegate;
21 namespace mozilla {
23 class OSXNotificationInfo;
25 class OSXNotificationCenter : public nsIAlertsService,
26 public nsIAlertsIconData,
27 public nsIAlertsDoNotDisturb,
28 public nsIAlertNotificationImageListener {
29 public:
30 NS_DECL_ISUPPORTS
31 NS_DECL_NSIALERTSSERVICE
32 NS_DECL_NSIALERTSICONDATA
33 NS_DECL_NSIALERTSDONOTDISTURB
34 NS_DECL_NSIALERTNOTIFICATIONIMAGELISTENER
36 OSXNotificationCenter();
38 nsresult Init();
39 void CloseAlertCocoaString(NSString* aAlertName);
40 void OnActivate(NSString* aAlertName,
41 NSUserNotificationActivationType aActivationType,
42 unsigned long long aAdditionalActionIndex);
43 void ShowPendingNotification(OSXNotificationInfo* osxni);
45 protected:
46 virtual ~OSXNotificationCenter();
48 private:
49 mozNotificationCenterDelegate* mDelegate;
50 nsTArray<RefPtr<OSXNotificationInfo> > mActiveAlerts;
51 nsTArray<RefPtr<OSXNotificationInfo> > mPendingAlerts;
52 bool mSuppressForScreenSharing;
55 } // namespace mozilla
57 #endif // OSXNotificationCenter_h