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_bluetoothpairinghandle_h
#define mozilla_dom_bluetooth_bluetoothpairinghandle_h

#include "BluetoothCommon.h"
#include "nsWrapperCache.h"

namespace mozilla {
class ErrorResult;
namespace dom {
class Promise;


class BluetoothPairingHandle final : public nsISupports
                                   , public nsWrapperCache

  static already_AddRefed<BluetoothPairingHandle>
    Create(nsPIDOMWindow* aOwner,
           const nsAString& aDeviceAddress,
           const nsAString& aType,
           const nsAString& aPasskey);

  nsPIDOMWindow* GetParentObject() const
    return mOwner;

  virtual JSObject* WrapObject(JSContext* aCx,
                               JS::Handle<JSObject*> aGivenProto) override;

  void GetPasskey(nsString& aPasskey) const
    aPasskey = mPasskey;

  // Reply to the enterpincodereq pairing request
    SetPinCode(const nsAString& aPinCode, ErrorResult& aRv);

  // Accept the pairingconfirmationreq or pairingconsentreq pairing request
  already_AddRefed<Promise> Accept(ErrorResult& aRv);

  // Reject the pairing request
  already_AddRefed<Promise> Reject(ErrorResult& aRv);

  BluetoothPairingHandle(nsPIDOMWindow* aOwner,
                         const nsAString& aDeviceAddress,
                         const nsAString& aType,
                         const nsAString& aPasskey);

   * Map mType into a BluetoothSspVariant enum value.
   * @param aVariant [out] BluetoothSspVariant value mapped from mType.
   * @return a boolean value to indicate whether mType can map into a
   *         BluetoothSspVariant value.
  bool GetSspVariant(BluetoothSspVariant& aVariant);

  nsCOMPtr<nsPIDOMWindow> mOwner;
  nsString mDeviceAddress;
  nsString mType;
  nsString mPasskey;


#endif // mozilla_dom_bluetooth_bluetoothpairinghandle_h