author Andrew McCreight <>
Sun, 03 May 2015 15:32:37 -0400
changeset 261130 bd079aadd3feeee3f9b9f73c5e0bc4bd6a870722
parent 258833 7617f4ffb3145987ec717a29789ff5636889fbf8
child 283312 c454836ffd1ee65b244c34e5d09e99ffd11fa966
permissions -rw-r--r--
Bug 1152551, part 2 - Fix mode lines in dom/. r=jst

/* -*- 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 */

#ifndef mozilla_dom_bluetooth_bluetoothpairinglistener_h
#define mozilla_dom_bluetooth_bluetoothpairinglistener_h

#include "BluetoothCommon.h"
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h"


class BluetoothSignal;

class BluetoothPairingListener final : public DOMEventTargetHelper
                                     , public BluetoothSignalObserver

  static already_AddRefed<BluetoothPairingListener>
    Create(nsPIDOMWindow* aWindow);

  void DispatchPairingEvent(const nsAString& aName,
                            const nsAString& aAddress,
                            const nsAString& aPasskey,
                            const nsAString& aType);

  void Notify(const BluetoothSignal& aParam); // BluetoothSignalObserver

  nsPIDOMWindow* GetParentObject() const
    return GetOwner();

  virtual JSObject* WrapObject(JSContext* aCx,
                               JS::Handle<JSObject*> aGivenProto) override;
  virtual void DisconnectFromOwner() override;
  virtual void EventListenerAdded(nsIAtom* aType) override;


  BluetoothPairingListener(nsPIDOMWindow* aWindow);

   * Listen to bluetooth signal if all pairing event handlers are ready.
   * Listen to bluetooth signal only if all pairing event handlers have been
   * attached. All pending pairing requests queued in BluetoothService would be
   * fired when pairing listener starts listening to bluetooth signal.
  void TryListeningToBluetoothSignal();

   * Indicate whether or not this pairing listener has started listening to
   * Bluetooth signal.
  bool mHasListenedToSignal;


#endif // mozilla_dom_bluetooth_bluetoothpairinglistener_h