Bug 1389057 - Inherit NotificationTelemetryService from nsIObserver
MozReview-Commit-ID: La4XxSWYljO
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -664,17 +664,17 @@ NotificationPermissionRequest::GetTypes(
{
nsTArray<nsString> emptyOptions;
return nsContentPermissionUtils::CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"),
NS_LITERAL_CSTRING("unused"),
emptyOptions,
aTypes);
}
-NS_IMPL_ISUPPORTS(NotificationTelemetryService, nsISupports)
+NS_IMPL_ISUPPORTS(NotificationTelemetryService, nsIObserver)
NotificationTelemetryService::NotificationTelemetryService()
: mDNDRecorded(false)
{}
NotificationTelemetryService::~NotificationTelemetryService()
{}
@@ -794,16 +794,24 @@ NotificationTelemetryService::RecordDNDS
if (NS_FAILED(rv)) {
return;
}
Telemetry::Accumulate(
Telemetry::ALERTS_SERVICE_DND_SUPPORTED_FLAG, true);
}
+NS_IMETHODIMP
+NotificationTelemetryService::Observe(nsISupports* aSubject,
+ const char* aTopic,
+ const char16_t* aData)
+{
+ return NS_OK;
+}
+
// Observer that the alert service calls to do common tasks and/or dispatch to the
// specific observer for the context e.g. main thread, worker, or service worker.
class NotificationObserver final : public nsIObserver
{
public:
nsCOMPtr<nsIObserver> mObserver;
nsCOMPtr<nsIPrincipal> mPrincipal;
bool mInPrivateBrowsing;
--- a/dom/notification/Notification.h
+++ b/dom/notification/Notification.h
@@ -47,20 +47,21 @@ public:
explicit NotificationWorkerHolder(Notification* aNotification);
bool
Notify(workers::Status aStatus) override;
};
// Records telemetry probes at application startup, when a notification is
// shown, and when the notification permission is revoked for a site.
-class NotificationTelemetryService final : public nsISupports
+class NotificationTelemetryService final : public nsIObserver
{
public:
NS_DECL_ISUPPORTS
+ NS_DECL_NSIOBSERVER
NotificationTelemetryService();
static already_AddRefed<NotificationTelemetryService> GetInstance();
nsresult Init();
void RecordDNDSupported();
void RecordPermissions();