mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 910915 - Add notification ID field to AppNotificationService; r=fabrice
This commit is contained in:
parent
49bc3978b7
commit
0d4ff9dec8
@ -7,13 +7,14 @@
|
||||
interface nsIObserver;
|
||||
|
||||
// Notification service that also provides the manifest URL
|
||||
[scriptable, uuid(7fb4f0f9-ff5b-4620-8e1b-d82d723605af)]
|
||||
[scriptable, uuid(61c4adf4-187d-4d18-937c-4df17bc01073)]
|
||||
interface nsIAppNotificationService : nsISupports
|
||||
{
|
||||
void showAppNotification(in AString imageUrl,
|
||||
in AString title,
|
||||
in AString text,
|
||||
[optional] in boolean textClickable,
|
||||
[optional] in AString manifestURL,
|
||||
[optional] in nsIObserver alertListener);
|
||||
in AString title,
|
||||
in AString text,
|
||||
[optional] in boolean textClickable,
|
||||
[optional] in AString manifestURL,
|
||||
[optional] in nsIObserver alertListener,
|
||||
[optional] in AString id);
|
||||
};
|
||||
|
@ -92,7 +92,8 @@ DesktopNotification::PostDesktopNotification()
|
||||
return appNotifier->ShowAppNotification(mIconURL, mTitle, mDescription,
|
||||
true,
|
||||
manifestUrl,
|
||||
mObserver);
|
||||
mObserver,
|
||||
EmptyString());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include "nsToolkitCompsCID.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#ifdef MOZ_B2G
|
||||
#include "nsIDOMDesktopNotification.h"
|
||||
#include "nsIAppsService.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -353,15 +357,36 @@ Notification::ShowInternal()
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserver> observer = new NotificationObserver(this);
|
||||
|
||||
nsString alertName;
|
||||
rv = GetAlertName(alertName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
nsCOMPtr<nsIAppNotificationService> appNotifier =
|
||||
do_GetService("@mozilla.org/system-alerts-service;1");
|
||||
if (appNotifier) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetOwner();
|
||||
uint32_t appId = (window.get())->GetDoc()->NodePrincipal()->GetAppId();
|
||||
|
||||
if (appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
nsCOMPtr<nsIAppsService> appsService = do_GetService("@mozilla.org/AppsService;1");
|
||||
nsString manifestUrl = EmptyString();
|
||||
appsService->GetManifestURLByLocalId(appId, manifestUrl);
|
||||
return appNotifier->ShowAppNotification(mIconUrl, mTitle, mBody,
|
||||
true,
|
||||
manifestUrl,
|
||||
observer,
|
||||
alertName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// In the case of IPC, the parent process uses the cookie to map to
|
||||
// nsIObserver. Thus the cookie must be unique to differentiate observers.
|
||||
nsString uniqueCookie = NS_LITERAL_STRING("notification:");
|
||||
uniqueCookie.AppendInt(sCount++);
|
||||
nsCOMPtr<nsIObserver> observer = new NotificationObserver(this);
|
||||
return alertService->ShowAlertNotification(absoluteUrl, mTitle, mBody, true,
|
||||
uniqueCookie, observer, alertName,
|
||||
DirectionToString(mDir), mLang);
|
||||
|
Loading…
Reference in New Issue
Block a user