author Sean Lin <>
Fri, 30 May 2014 11:11:23 +0800
changeset 186401 3dd59dda51fce8a55862a61061a35dc61307d86e
parent 159475 a8b06549f680c3bec8c15a629e437c6e20848238
child 190359 461ad7d4f1ef5c99b4817b2ec3c9dbf8681e0b5e
permissions -rw-r--r--
Bug 911242 - [LED] De-couple the control of screen backlight and keyboard backlight. r=dhylands, sr=sicking

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */
/* 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 */

#ifndef nsXULAlerts_h__
#define nsXULAlerts_h__

#include "nsHashKeys.h"
#include "nsInterfaceHashtable.h"

#include "nsIDOMWindow.h"
#include "nsIObserver.h"

class nsXULAlerts {
  friend class nsXULAlertObserver;

  virtual ~nsXULAlerts() {}

  nsresult ShowAlertNotification(const nsAString& aImageUrl, const nsAString& aAlertTitle,
                                 const nsAString& aAlertText, bool aAlertTextClickable,
                                 const nsAString& aAlertCookie, nsIObserver* aAlertListener,
                                 const nsAString& aAlertName, const nsAString& aBidi,
                                 const nsAString& aLang);

  nsresult CloseAlert(const nsAString& aAlertName);
  nsInterfaceHashtable<nsStringHashKey, nsIDOMWindow> mNamedWindows;

 * This class wraps observers for alerts and watches
 * for the "alertfinished" event in order to release
 * the reference on the nsIDOMWindow of the XUL alert.
class nsXULAlertObserver : public nsIObserver {

  nsXULAlertObserver(nsXULAlerts* aXULAlerts, const nsAString& aAlertName,
                     nsIObserver* aObserver)
    : mXULAlerts(aXULAlerts), mAlertName(aAlertName),
      mObserver(aObserver) {}

  void SetAlertWindow(nsIDOMWindow* aWindow) { mAlertWindow = aWindow; }

  virtual ~nsXULAlertObserver() {}
  nsXULAlerts* mXULAlerts;
  nsString mAlertName;
  nsCOMPtr<nsIDOMWindow> mAlertWindow;
  nsCOMPtr<nsIObserver> mObserver;

#endif /* nsXULAlerts_h__ */