nsresult PushNotifier::NotifyPushObservers(const nsACString& aScope, const Maybe<nsTArray<uint8_t>>& aData) { nsCOMPtr<nsIPushMessage> message = nullptr; if (aData) { message = new PushMessage(aData.ref()); } return DoNotifyObservers(message, OBSERVER_TOPIC_PUSH, aScope); }
nsresult PushMessageDispatcher::NotifyObservers() { nsCOMPtr<nsIPushData> data; if (mData) { data = new PushData(mData.ref()); } nsCOMPtr<nsIPushMessage> message = new PushMessage(mPrincipal, data); return DoNotifyObservers(message, OBSERVER_TOPIC_PUSH, mScope); }
nsresult PushNotifier::NotifySubscriptionLostObservers(const nsACString& aScope, uint16_t aReason) { nsCOMPtr<nsISupportsPRUint16> wrapper = do_CreateInstance(NS_SUPPORTS_PRUINT16_CONTRACTID); if (NS_WARN_IF(!wrapper || NS_FAILED(wrapper->SetData(aReason)))) { return NS_ERROR_FAILURE; } return DoNotifyObservers(wrapper, OBSERVER_TOPIC_SUBSCRIPTION_LOST, aScope); }
nsresult PushNotifier::NotifySubscriptionChangeObservers(const nsACString& aScope) { return DoNotifyObservers(nullptr, OBSERVER_TOPIC_SUBSCRIPTION_CHANGE, aScope); }
nsresult PushSubscriptionModifiedDispatcher::NotifyObservers() { return DoNotifyObservers(mPrincipal, OBSERVER_TOPIC_SUBSCRIPTION_MODIFIED, mScope); }
nsresult PushSubscriptionChangeDispatcher::NotifyObservers() { return DoNotifyObservers(mPrincipal, OBSERVER_TOPIC_SUBSCRIPTION_CHANGE, mScope); }