dom/fm/FMRadio.h
author Bas Schouten <bschouten@mozilla.com>
Fri, 21 Sep 2012 22:12:28 +0000
changeset 107768 259206b2c7b25d08ac11125c814de0ee43ea121a
parent 107522 75923725b2fc72927458f6281a78ebaab8f6bc71
child 108767 ef201a4b3f37010396f8cb865f3d4496fd1232cc
permissions -rw-r--r--
Bug 792190: Relax D3D9 driver version requirements. r=bjacob

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

#include "nsCOMPtr.h"
#include "mozilla/HalTypes.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIFMRadio.h"

#define NS_FMRADIO_CONTRACTID "@mozilla.org/fmradio;1"
// 9cb91834-78a9-4029-b644-7806173c5e2d
#define NS_FMRADIO_CID {0x9cb91834, 0x78a9, 0x4029, \
      {0xb6, 0x44, 0x78, 0x06, 0x17, 0x3c, 0x5e, 0x2d}}

namespace mozilla {
namespace dom {
namespace fm {

/* Header file */
class FMRadio : public nsDOMEventTargetHelper
              , public nsIFMRadio
              , public hal::FMRadioObserver
              , public hal::SwitchObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIFMRADIO

  NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
                                                   FMRadio,
                                                   nsDOMEventTargetHelper)
  FMRadio();
  virtual void Notify(const hal::FMRadioOperationInformation& info);
  virtual void Notify(const hal::SwitchEvent& aEvent);

private:
  ~FMRadio();
  bool mHasInternalAntenna;
  hal::SwitchState mHeadphoneState;
  /**
   * Dispatch a trusted non-cancellable and no-bubbling event to itself
   */
  nsresult DispatchTrustedEventToSelf(const nsAString& aEventName);
};

} // namespace fm
} // namespace dom
} // namespace mozilla
#endif