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