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"
23 BEGIN_BLUETOOTH_NAMESPACE
25 class BluetoothNamedValue
;
27 class BluetoothManager
: public DOMEventTargetHelper
28 , public BluetoothSignalObserver
29 , public BluetoothPropertyContainer
32 NS_DECL_ISUPPORTS_INHERITED
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
);
43 already_AddRefed
<DOMRequest
> GetDefaultAdapter(ErrorResult
& aRv
);
45 IMPL_EVENT_HANDLER(enabled
);
46 IMPL_EVENT_HANDLER(disabled
);
47 IMPL_EVENT_HANDLER(adapteradded
);
49 nsPIDOMWindow
* GetParentObject() const
55 WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
57 virtual void DisconnectFromOwner() MOZ_OVERRIDE
;
60 BluetoothManager(nsPIDOMWindow
* aWindow
);
64 END_BLUETOOTH_NAMESPACE