示例#1
0
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);
}
示例#2
0
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);
}
示例#3
0
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);
}
示例#4
0
nsresult
PushNotifier::NotifySubscriptionChangeObservers(const nsACString& aScope)
{
  return DoNotifyObservers(nullptr, OBSERVER_TOPIC_SUBSCRIPTION_CHANGE, aScope);
}
示例#5
0
nsresult
PushSubscriptionModifiedDispatcher::NotifyObservers()
{
  return DoNotifyObservers(mPrincipal, OBSERVER_TOPIC_SUBSCRIPTION_MODIFIED,
                           mScope);
}
示例#6
0
nsresult
PushSubscriptionChangeDispatcher::NotifyObservers()
{
  return DoNotifyObservers(mPrincipal, OBSERVER_TOPIC_SUBSCRIPTION_CHANGE,
                           mScope);
}