toolkit/components/alerts/nsXULAlerts.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsXULAlerts_h__
     7 #define nsXULAlerts_h__
     9 #include "nsHashKeys.h"
    10 #include "nsInterfaceHashtable.h"
    12 #include "nsIDOMWindow.h"
    13 #include "nsIObserver.h"
    15 class nsXULAlerts {
    16   friend class nsXULAlertObserver;
    17 public:
    18   nsXULAlerts()
    19   {
    20   }
    22   virtual ~nsXULAlerts() {}
    24   nsresult ShowAlertNotification(const nsAString& aImageUrl, const nsAString& aAlertTitle,
    25                                  const nsAString& aAlertText, bool aAlertTextClickable,
    26                                  const nsAString& aAlertCookie, nsIObserver* aAlertListener,
    27                                  const nsAString& aAlertName, const nsAString& aBidi,
    28                                  const nsAString& aLang);
    30   nsresult CloseAlert(const nsAString& aAlertName);
    31 protected:
    32   nsInterfaceHashtable<nsStringHashKey, nsIDOMWindow> mNamedWindows;
    33 };
    35 /**
    36  * This class wraps observers for alerts and watches
    37  * for the "alertfinished" event in order to release
    38  * the reference on the nsIDOMWindow of the XUL alert.
    39  */
    40 class nsXULAlertObserver : public nsIObserver {
    41 public:
    42   NS_DECL_ISUPPORTS
    43   NS_DECL_NSIOBSERVER
    45   nsXULAlertObserver(nsXULAlerts* aXULAlerts, const nsAString& aAlertName,
    46                      nsIObserver* aObserver)
    47     : mXULAlerts(aXULAlerts), mAlertName(aAlertName),
    48       mObserver(aObserver) {}
    50   void SetAlertWindow(nsIDOMWindow* aWindow) { mAlertWindow = aWindow; }
    52   virtual ~nsXULAlertObserver() {}
    53 protected:
    54   nsXULAlerts* mXULAlerts;
    55   nsString mAlertName;
    56   nsCOMPtr<nsIDOMWindow> mAlertWindow;
    57   nsCOMPtr<nsIObserver> mObserver;
    58 };
    60 #endif /* nsXULAlerts_h__ */

mercurial