michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_bluetooth_bluetoothmanager_h__ michael@0: #define mozilla_dom_bluetooth_bluetoothmanager_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/DOMEventTargetHelper.h" michael@0: #include "mozilla/Observer.h" michael@0: #include "BluetoothCommon.h" michael@0: #include "BluetoothPropertyContainer.h" michael@0: #include "nsISupportsImpl.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class DOMRequest; michael@0: } michael@0: } michael@0: michael@0: BEGIN_BLUETOOTH_NAMESPACE michael@0: michael@0: class BluetoothNamedValue; michael@0: michael@0: class BluetoothManager : public DOMEventTargetHelper michael@0: , public BluetoothSignalObserver michael@0: , public BluetoothPropertyContainer michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: // Never returns null michael@0: static already_AddRefed michael@0: Create(nsPIDOMWindow* aWindow); michael@0: static bool CheckPermission(nsPIDOMWindow* aWindow); michael@0: void Notify(const BluetoothSignal& aData); michael@0: virtual void SetPropertyByValue(const BluetoothNamedValue& aValue) MOZ_OVERRIDE; michael@0: michael@0: bool GetEnabled(ErrorResult& aRv); michael@0: bool IsConnected(uint16_t aProfileId, ErrorResult& aRv); michael@0: michael@0: already_AddRefed GetDefaultAdapter(ErrorResult& aRv); michael@0: michael@0: IMPL_EVENT_HANDLER(enabled); michael@0: IMPL_EVENT_HANDLER(disabled); michael@0: IMPL_EVENT_HANDLER(adapteradded); michael@0: michael@0: nsPIDOMWindow* GetParentObject() const michael@0: { michael@0: return GetOwner(); michael@0: } michael@0: michael@0: virtual JSObject* michael@0: WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: virtual void DisconnectFromOwner() MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: BluetoothManager(nsPIDOMWindow* aWindow); michael@0: ~BluetoothManager(); michael@0: }; michael@0: michael@0: END_BLUETOOTH_NAMESPACE michael@0: michael@0: #endif