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.

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

mercurial