Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  NotificationParent.h   Sprache: C

 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 DOM_NOTIFICATION_NOTIFICATIONPARENT_H_
#define DOM_NOTIFICATION_NOTIFICATIONPARENT_H_

#include "mozilla/dom/notification/PNotificationParent.h"
#include "mozilla/ipc/PBackgroundParent.h"
#include "mozilla/dom/DOMTypes.h"

namespace mozilla::dom::notification {

enum class CloseMode;

class NotificationParent final : public PNotificationParent,
                                 public nsIObserver {
  using IPCResult = mozilla::ipc::IPCResult;

 public:
  // Threadsafe to pass the class from PBackground to main thread
  NS_DECL_THREADSAFE_ISUPPORTS
  NS_DECL_NSIOBSERVER

  NotificationParent(NotNull<nsIPrincipal*> aPrincipal,
                     NotNull<nsIPrincipal*> aEffectiveStoragePrincipal,
                     bool aIsSecureContext, const nsAString& aId,
                     const nsAString& aScope,
                     const IPCNotificationOptions& aOptions)
      : mPrincipal(aPrincipal),
        mEffectiveStoragePrincipal(aEffectiveStoragePrincipal),
        mIsSecureContext(aIsSecureContext),
        mId(aId),
        mScope(aScope),
        mOptions(aOptions) {};

  IPCResult RecvShow(ShowResolver&& aResolver);
  IPCResult RecvClose();

  nsresult BindToMainThread(
      Endpoint<PNotificationParent>&& aParentEndpoint,
      PBackgroundParent::CreateNotificationParentResolver&& aResolver);

  void ActorDestroy(ActorDestroyReason aWhy) override;

 private:
  ~NotificationParent() = default;

  nsresult Show();
  nsresult FireClickEvent();
  nsresult FireCloseEvent();

  void Unregister(CloseMode aCloseMode);

  void GetAlertName(nsAString& aRetval) {
    if (mAlertName.IsEmpty()) {
      MaybeInitAlertName();
    }
    aRetval = mAlertName;
  }
  void MaybeInitAlertName();

  Maybe<NotificationParent::ShowResolver> mResolver;

  NotNull<nsCOMPtr<nsIPrincipal>> mPrincipal;
  NotNull<nsCOMPtr<nsIPrincipal>> mEffectiveStoragePrincipal;
  bool mIsSecureContext;
  nsString mId;
  nsString mScope;
  IPCNotificationOptions mOptions;

  nsString mAlertName;

  // Whether it's now a dangling actor without corresponding OS notification,
  // either because it's closed or denied permission. We don't have to call
  // CloseAlert if this is the case.
  bool mDangling = false;
};

}  // namespace mozilla::dom::notification

#endif  // DOM_NOTIFICATION_NOTIFICATIONPARENT_H_

Messung V0.5
C=85 H=100 G=92

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge