dom/bluetooth/BluetoothManager.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.

     1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_bluetooth_bluetoothmanager_h__
     8 #define mozilla_dom_bluetooth_bluetoothmanager_h__
    10 #include "mozilla/Attributes.h"
    11 #include "mozilla/DOMEventTargetHelper.h"
    12 #include "mozilla/Observer.h"
    13 #include "BluetoothCommon.h"
    14 #include "BluetoothPropertyContainer.h"
    15 #include "nsISupportsImpl.h"
    17 namespace mozilla {
    18 namespace dom {
    19 class DOMRequest;
    20 }
    21 }
    23 BEGIN_BLUETOOTH_NAMESPACE
    25 class BluetoothNamedValue;
    27 class BluetoothManager : public DOMEventTargetHelper
    28                        , public BluetoothSignalObserver
    29                        , public BluetoothPropertyContainer
    30 {
    31 public:
    32   NS_DECL_ISUPPORTS_INHERITED
    34   // Never returns null
    35   static already_AddRefed<BluetoothManager>
    36     Create(nsPIDOMWindow* aWindow);
    37   static bool CheckPermission(nsPIDOMWindow* aWindow);
    38   void Notify(const BluetoothSignal& aData);
    39   virtual void SetPropertyByValue(const BluetoothNamedValue& aValue) MOZ_OVERRIDE;
    41   bool GetEnabled(ErrorResult& aRv);
    42   bool IsConnected(uint16_t aProfileId, ErrorResult& aRv);
    44   already_AddRefed<DOMRequest> GetDefaultAdapter(ErrorResult& aRv);
    46   IMPL_EVENT_HANDLER(enabled);
    47   IMPL_EVENT_HANDLER(disabled);
    48   IMPL_EVENT_HANDLER(adapteradded);
    50   nsPIDOMWindow* GetParentObject() const
    51   {
    52      return GetOwner();
    53   }
    55   virtual JSObject*
    56     WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    58   virtual void DisconnectFromOwner() MOZ_OVERRIDE;
    60 private:
    61   BluetoothManager(nsPIDOMWindow* aWindow);
    62   ~BluetoothManager();
    63 };
    65 END_BLUETOOTH_NAMESPACE
    67 #endif

mercurial