2015-09-25 23:18:29 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-12-06 03:05:10 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef OSXNotificationCenter_h
|
|
|
|
#define OSXNotificationCenter_h
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#include "nsIAlertsService.h"
|
|
|
|
#include "imgINotificationObserver.h"
|
|
|
|
#include "nsITimer.h"
|
|
|
|
#include "nsTArray.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2013-12-06 03:05:10 +04:00
|
|
|
|
2018-01-06 00:28:24 +03:00
|
|
|
// mozNotificationCenterDelegate is used to access the macOS notification
|
|
|
|
// center. It is not related to the DesktopNotificationCenter object, which was
|
|
|
|
// removed in bug 952453. While there are no direct references to this class
|
|
|
|
// elsewhere, removing this will cause push notifications on macOS to stop
|
|
|
|
// working.
|
2018-01-04 23:45:54 +03:00
|
|
|
@class mozNotificationCenterDelegate;
|
|
|
|
|
2015-09-25 23:18:29 +03:00
|
|
|
#if !defined(MAC_OS_X_VERSION_10_8) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8)
|
|
|
|
typedef NSInteger NSUserNotificationActivationType;
|
|
|
|
#endif
|
|
|
|
|
2013-12-06 03:05:10 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class OSXNotificationInfo;
|
|
|
|
|
|
|
|
class OSXNotificationCenter : public nsIAlertsService,
|
2016-06-11 04:59:25 +03:00
|
|
|
public nsIAlertsIconData,
|
|
|
|
public nsIAlertNotificationImageListener {
|
2013-12-06 03:05:10 +04:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIALERTSSERVICE
|
2016-01-07 23:16:54 +03:00
|
|
|
NS_DECL_NSIALERTSICONDATA
|
2016-06-11 04:59:25 +03:00
|
|
|
NS_DECL_NSIALERTNOTIFICATIONIMAGELISTENER
|
2013-12-06 03:05:10 +04:00
|
|
|
|
|
|
|
OSXNotificationCenter();
|
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
void CloseAlertCocoaString(NSString *aAlertName);
|
2015-09-25 23:18:29 +03:00
|
|
|
void OnActivate(NSString *aAlertName, NSUserNotificationActivationType aActivationType,
|
|
|
|
unsigned long long aAdditionalActionIndex);
|
2013-12-06 03:05:10 +04:00
|
|
|
void ShowPendingNotification(OSXNotificationInfo *osxni);
|
|
|
|
|
2014-07-06 19:25:31 +04:00
|
|
|
protected:
|
|
|
|
virtual ~OSXNotificationCenter();
|
|
|
|
|
2013-12-06 03:05:10 +04:00
|
|
|
private:
|
2018-01-04 23:45:54 +03:00
|
|
|
mozNotificationCenterDelegate *mDelegate;
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<OSXNotificationInfo> > mActiveAlerts;
|
|
|
|
nsTArray<RefPtr<OSXNotificationInfo> > mPendingAlerts;
|
2013-12-06 03:05:10 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // OSXNotificationCenter_h
|