2012-05-23 21:02:23 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
2012-08-20 20:21:24 -07:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-23 21:02:23 -07:00
|
|
|
/* 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
#include "base/basictypes.h"
|
2012-05-23 21:02:23 -07:00
|
|
|
#include "BluetoothManager.h"
|
|
|
|
#include "BluetoothCommon.h"
|
|
|
|
#include "BluetoothAdapter.h"
|
2012-07-17 20:41:54 -07:00
|
|
|
#include "BluetoothService.h"
|
|
|
|
#include "BluetoothTypes.h"
|
|
|
|
#include "BluetoothReplyRunnable.h"
|
2012-05-23 21:02:23 -07:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
#include "nsContentUtils.h"
|
2012-05-23 21:02:23 -07:00
|
|
|
#include "nsDOMClassInfo.h"
|
|
|
|
#include "nsDOMEvent.h"
|
2012-08-29 23:08:50 -07:00
|
|
|
#include "nsDOMEventTargetHelper.h"
|
|
|
|
#include "nsIDOMDOMRequest.h"
|
|
|
|
#include "nsIJSContextStack.h"
|
|
|
|
#include "nsIObserverService.h"
|
|
|
|
#include "nsIPermissionManager.h"
|
2012-05-23 21:02:23 -07:00
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "nsXPCOMCIDInternal.h"
|
|
|
|
#include "mozilla/LazyIdleThread.h"
|
2012-08-29 23:08:50 -07:00
|
|
|
#include "mozilla/Services.h"
|
2012-05-23 21:02:23 -07:00
|
|
|
#include "mozilla/Util.h"
|
2012-08-25 09:33:51 -07:00
|
|
|
#include "nsIDOMDOMRequest.h"
|
2012-05-23 21:02:23 -07:00
|
|
|
|
2012-06-02 11:23:16 -07:00
|
|
|
using namespace mozilla;
|
2012-05-23 21:02:23 -07:00
|
|
|
|
|
|
|
USING_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
DOMCI_DATA(BluetoothManager, BluetoothManager)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(BluetoothManager)
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(BluetoothManager,
|
2012-05-23 21:02:23 -07:00
|
|
|
nsDOMEventTargetHelper)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(BluetoothManager,
|
2012-05-23 21:02:23 -07:00
|
|
|
nsDOMEventTargetHelper)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BluetoothManager)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMBluetoothManager)
|
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(BluetoothManager)
|
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF_INHERITED(BluetoothManager, nsDOMEventTargetHelper)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(BluetoothManager, nsDOMEventTargetHelper)
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
class GetAdapterTask : public BluetoothReplyRunnable
|
2012-05-23 21:02:23 -07:00
|
|
|
{
|
2012-07-17 20:41:54 -07:00
|
|
|
public:
|
|
|
|
GetAdapterTask(BluetoothManager* aManager,
|
|
|
|
nsIDOMDOMRequest* aReq) :
|
|
|
|
BluetoothReplyRunnable(aReq),
|
|
|
|
mManagerPtr(aManager)
|
|
|
|
{
|
|
|
|
}
|
2012-05-23 21:02:23 -07:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
bool
|
|
|
|
ParseSuccessfulReply(jsval* aValue)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMBluetoothAdapter> adapter;
|
|
|
|
*aValue = JSVAL_VOID;
|
|
|
|
|
2012-08-08 10:47:09 -07:00
|
|
|
const InfallibleTArray<BluetoothNamedValue>& v =
|
|
|
|
mReply->get_BluetoothReplySuccess().value().get_ArrayOfBluetoothNamedValue();
|
|
|
|
adapter = BluetoothAdapter::Create(mManagerPtr->GetOwner(), v);
|
2012-07-17 20:41:54 -07:00
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
nsIScriptContext* sc = mManagerPtr->GetContextForEventHandlers(&rv);
|
|
|
|
if (!sc) {
|
|
|
|
NS_WARNING("Cannot create script context!");
|
|
|
|
SetError(NS_LITERAL_STRING("BluetoothScriptContextError"));
|
|
|
|
return false;
|
2012-05-23 21:02:23 -07:00
|
|
|
}
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
rv = nsContentUtils::WrapNative(sc->GetNativeContext(),
|
|
|
|
sc->GetNativeGlobal(),
|
|
|
|
adapter,
|
|
|
|
aValue);
|
|
|
|
bool result = NS_SUCCEEDED(rv) ? true : false;
|
|
|
|
if (!result) {
|
|
|
|
NS_WARNING("Cannot create native object!");
|
|
|
|
SetError(NS_LITERAL_STRING("BluetoothNativeObjectError"));
|
2012-05-23 21:02:23 -07:00
|
|
|
}
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
return result;
|
|
|
|
}
|
2012-05-23 21:02:23 -07:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
void
|
|
|
|
ReleaseMembers()
|
|
|
|
{
|
|
|
|
BluetoothReplyRunnable::ReleaseMembers();
|
2012-07-30 07:20:58 -07:00
|
|
|
mManagerPtr = nullptr;
|
2012-07-17 20:41:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<BluetoothManager> mManagerPtr;
|
|
|
|
};
|
2012-05-23 21:02:23 -07:00
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
class ToggleBtResultTask : public nsRunnable
|
2012-07-17 20:41:54 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-08-29 23:08:50 -07:00
|
|
|
ToggleBtResultTask(BluetoothManager* aManager, bool aEnabled)
|
|
|
|
: mManagerPtr(aManager),
|
2012-07-17 20:41:54 -07:00
|
|
|
mEnabled(aEnabled)
|
|
|
|
{
|
|
|
|
}
|
2012-05-23 21:02:23 -07:00
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
NS_IMETHOD Run()
|
2012-07-17 20:41:54 -07:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2012-08-29 23:08:50 -07:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
mManagerPtr->SetEnabledInternal(mEnabled);
|
2012-08-29 23:08:50 -07:00
|
|
|
mManagerPtr->FireEnabledDisabledEvent();
|
2012-05-23 21:02:23 -07:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
// mManagerPtr must be null before returning to prevent the background
|
|
|
|
// thread from racing to release it during the destruction of this runnable.
|
2012-07-30 07:20:58 -07:00
|
|
|
mManagerPtr = nullptr;
|
2012-08-29 23:08:50 -07:00
|
|
|
|
|
|
|
return NS_OK;
|
2012-07-17 20:41:54 -07:00
|
|
|
}
|
2012-08-29 23:08:50 -07:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
private:
|
|
|
|
nsRefPtr<BluetoothManager> mManagerPtr;
|
|
|
|
bool mEnabled;
|
2012-05-23 21:02:23 -07:00
|
|
|
};
|
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
nsresult
|
|
|
|
BluetoothManager::FireEnabledDisabledEvent()
|
|
|
|
{
|
|
|
|
nsString eventName;
|
|
|
|
|
|
|
|
if (mEnabled) {
|
|
|
|
eventName.AssignLiteral("enabled");
|
|
|
|
} else {
|
|
|
|
eventName.AssignLiteral("disabled");
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<nsDOMEvent> event = new nsDOMEvent(nullptr, nullptr);
|
|
|
|
nsresult rv = event->InitEvent(eventName, false, false);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
rv = event->SetTrusted(true);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
bool dummy;
|
|
|
|
rv = DispatchEvent(event, &dummy);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-05-23 21:02:23 -07:00
|
|
|
BluetoothManager::BluetoothManager(nsPIDOMWindow *aWindow) :
|
2012-07-31 21:53:04 -07:00
|
|
|
BluetoothPropertyContainer(BluetoothObjectType::TYPE_MANAGER),
|
2012-07-17 20:41:54 -07:00
|
|
|
mEnabled(false)
|
2012-05-23 21:02:23 -07:00
|
|
|
{
|
|
|
|
BindToOwner(aWindow);
|
2012-07-31 21:53:04 -07:00
|
|
|
mPath.AssignLiteral("/");
|
2012-08-29 23:08:50 -07:00
|
|
|
|
|
|
|
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
|
|
|
obs->AddObserver(this, "mozsettings-changed", false);
|
2012-05-23 21:02:23 -07:00
|
|
|
}
|
|
|
|
|
2012-06-02 11:23:16 -07:00
|
|
|
BluetoothManager::~BluetoothManager()
|
|
|
|
{
|
2012-07-17 20:41:54 -07:00
|
|
|
BluetoothService* bs = BluetoothService::Get();
|
|
|
|
// We can be null on shutdown, where this might happen
|
|
|
|
if (bs) {
|
2012-07-31 21:53:04 -07:00
|
|
|
if (NS_FAILED(bs->UnregisterBluetoothSignalHandler(mPath, this))) {
|
2012-07-17 20:41:54 -07:00
|
|
|
NS_WARNING("Failed to unregister object with observer!");
|
|
|
|
}
|
2012-06-02 11:23:16 -07:00
|
|
|
}
|
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
|
|
|
obs->RemoveObserver(this, "mozsettings-changed");
|
2012-07-31 21:53:04 -07:00
|
|
|
}
|
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
nsresult
|
|
|
|
BluetoothManager::HandleMozsettingChanged(const PRUnichar* aData)
|
2012-05-23 21:02:23 -07:00
|
|
|
{
|
2012-08-29 23:08:50 -07:00
|
|
|
// The string that we're interested in will be a JSON string that looks like:
|
|
|
|
// {"key":"bluetooth.enabled","value":true}
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
nsIScriptContext* sc = GetContextForEventHandlers(&rv);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-07-31 21:53:04 -07:00
|
|
|
}
|
2012-07-17 20:41:54 -07:00
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
JSContext *cx = sc->GetNativeContext();
|
|
|
|
if (!cx) {
|
|
|
|
return NS_OK;
|
2012-05-23 21:02:23 -07:00
|
|
|
}
|
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
// In the following [if] blocks, NS_OK will be returned even if JS_* functions
|
|
|
|
// return false. That's because this function gets called whenever mozSettings
|
|
|
|
// changes, so that we'll receive signals we're not interested in and it would
|
|
|
|
// be one of the reasons for making JS_* functions return false.
|
|
|
|
nsDependentString dataStr(aData);
|
|
|
|
JS::Value val;
|
|
|
|
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!val.isObject()) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSObject &obj(val.toObject());
|
|
|
|
JS::Value key;
|
|
|
|
if (!JS_GetProperty(cx, &obj, "key", &key)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!key.isString()) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSBool match;
|
|
|
|
if (!JS_StringEqualsAscii(cx, key.toString(), "bluetooth.enabled", &match)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!match) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS::Value value;
|
|
|
|
if (!JS_GetProperty(cx, &obj, "value", &value)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!value.isBoolean()) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
BluetoothService* bs = BluetoothService::Get();
|
|
|
|
if (!bs) {
|
|
|
|
NS_WARNING("BluetoothService not available!");
|
2012-07-17 20:41:54 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
2012-05-23 21:02:23 -07:00
|
|
|
}
|
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
bool enabled = value.toBoolean();
|
|
|
|
nsCOMPtr<nsIRunnable> resultTask = new ToggleBtResultTask(this, enabled);
|
|
|
|
|
|
|
|
if (enabled) {
|
|
|
|
if (NS_FAILED(bs->Start(resultTask))) {
|
2012-07-17 20:41:54 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2012-08-29 23:08:50 -07:00
|
|
|
} else {
|
|
|
|
if (NS_FAILED(bs->Stop(resultTask))) {
|
2012-07-17 20:41:54 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
2012-05-23 21:02:23 -07:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-29 23:08:50 -07:00
|
|
|
NS_IMETHODIMP
|
|
|
|
BluetoothManager::Observe(nsISupports* aSubject,
|
|
|
|
const char* aTopic,
|
|
|
|
const PRUnichar* aData)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
if (!strcmp("mozsettings-changed", aTopic)) {
|
|
|
|
rv = HandleMozsettingChanged(aData);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothManager::SetPropertyByValue(const BluetoothNamedValue& aValue)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
const nsString& name = aValue.name();
|
|
|
|
nsCString warningMsg;
|
|
|
|
warningMsg.AssignLiteral("Not handling manager property: ");
|
|
|
|
warningMsg.Append(NS_ConvertUTF16toUTF8(name));
|
|
|
|
NS_WARNING(warningMsg.get());
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-05-23 21:02:23 -07:00
|
|
|
NS_IMETHODIMP
|
|
|
|
BluetoothManager::GetEnabled(bool* aEnabled)
|
|
|
|
{
|
|
|
|
*aEnabled = mEnabled;
|
2012-07-17 20:41:54 -07:00
|
|
|
return NS_OK;
|
2012-05-23 21:02:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-07-17 20:41:54 -07:00
|
|
|
BluetoothManager::GetDefaultAdapter(nsIDOMDOMRequest** aAdapter)
|
2012-05-23 21:02:23 -07:00
|
|
|
{
|
2012-07-17 20:41:54 -07:00
|
|
|
BluetoothService* bs = BluetoothService::Get();
|
2012-07-31 21:53:04 -07:00
|
|
|
if (!bs) {
|
|
|
|
NS_WARNING("BluetoothService not available!");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2012-07-17 20:41:54 -07:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMRequestService> rs = do_GetService("@mozilla.org/dom/dom-request-service;1");
|
|
|
|
|
|
|
|
if (!rs) {
|
|
|
|
NS_WARNING("No DOMRequest Service!");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMDOMRequest> request;
|
|
|
|
nsresult rv = rs->CreateRequest(GetOwner(), getter_AddRefs(request));
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
NS_WARNING("Can't create DOMRequest!");
|
2012-06-02 11:23:16 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2012-07-17 20:41:54 -07:00
|
|
|
|
|
|
|
nsRefPtr<BluetoothReplyRunnable> results = new GetAdapterTask(this, request);
|
|
|
|
|
|
|
|
if (NS_FAILED(bs->GetDefaultAdapterPathInternal(results))) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
request.forget(aAdapter);
|
2012-06-02 11:23:16 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
already_AddRefed<BluetoothManager>
|
|
|
|
BluetoothManager::Create(nsPIDOMWindow* aWindow) {
|
2012-07-17 20:41:54 -07:00
|
|
|
|
2012-06-02 11:23:16 -07:00
|
|
|
nsRefPtr<BluetoothManager> manager = new BluetoothManager(aWindow);
|
2012-07-17 20:41:54 -07:00
|
|
|
BluetoothService* bs = BluetoothService::Get();
|
2012-07-31 21:53:04 -07:00
|
|
|
if (!bs) {
|
|
|
|
NS_WARNING("BluetoothService not available!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
2012-07-17 20:41:54 -07:00
|
|
|
|
|
|
|
if (NS_FAILED(bs->RegisterBluetoothSignalHandler(NS_LITERAL_STRING("/"), manager))) {
|
|
|
|
NS_ERROR("Failed to register object with observer!");
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2012-06-02 11:23:16 -07:00
|
|
|
}
|
2012-07-17 20:41:54 -07:00
|
|
|
|
2012-06-02 11:23:16 -07:00
|
|
|
return manager.forget();
|
2012-05-23 21:02:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-06-02 11:23:16 -07:00
|
|
|
NS_NewBluetoothManager(nsPIDOMWindow* aWindow,
|
|
|
|
nsIDOMBluetoothManager** aBluetoothManager)
|
2012-05-23 21:02:23 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aWindow, "Null pointer!");
|
|
|
|
|
2012-08-07 21:10:36 -07:00
|
|
|
nsPIDOMWindow* innerWindow = aWindow->IsInnerWindow() ?
|
|
|
|
aWindow :
|
|
|
|
aWindow->GetCurrentInnerWindow();
|
|
|
|
|
|
|
|
// Need the document for security check.
|
|
|
|
nsCOMPtr<nsIDocument> document = innerWindow->GetExtantDoc();
|
|
|
|
NS_ENSURE_TRUE(document, NS_NOINTERFACE);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrincipal> principal = document->NodePrincipal();
|
|
|
|
NS_ENSURE_TRUE(principal, NS_ERROR_UNEXPECTED);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPermissionManager> permMgr =
|
|
|
|
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
|
|
|
NS_ENSURE_TRUE(permMgr, NS_ERROR_UNEXPECTED);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t permission;
|
2012-08-07 21:10:36 -07:00
|
|
|
nsresult rv =
|
|
|
|
permMgr->TestPermissionFromPrincipal(principal, "mozBluetooth", &permission);
|
2012-05-23 21:02:23 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2012-07-17 20:41:54 -07:00
|
|
|
|
2012-08-07 21:10:36 -07:00
|
|
|
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
2012-07-30 07:20:58 -07:00
|
|
|
*aBluetoothManager = nullptr;
|
2012-05-23 21:02:23 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-06-02 11:23:16 -07:00
|
|
|
nsRefPtr<BluetoothManager> bluetoothManager = BluetoothManager::Create(aWindow);
|
2012-07-17 20:41:54 -07:00
|
|
|
if (!bluetoothManager) {
|
|
|
|
NS_ERROR("Cannot create bluetooth manager!");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2012-08-07 21:10:36 -07:00
|
|
|
|
2012-05-23 21:02:23 -07:00
|
|
|
bluetoothManager.forget(aBluetoothManager);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-06-02 11:23:16 -07:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
void
|
|
|
|
BluetoothManager::Notify(const BluetoothSignal& aData)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
nsCString warningMsg;
|
|
|
|
warningMsg.AssignLiteral("Not handling manager signal: ");
|
|
|
|
warningMsg.Append(NS_ConvertUTF16toUTF8(aData.name()));
|
|
|
|
NS_WARNING(warningMsg.get());
|
|
|
|
#endif
|
2012-06-02 11:23:16 -07:00
|
|
|
}
|
2012-08-29 23:08:50 -07:00
|
|
|
|
|
|
|
NS_IMPL_EVENT_HANDLER(BluetoothManager, enabled)
|
|
|
|
NS_IMPL_EVENT_HANDLER(BluetoothManager, disabled)
|