Files
palemoon27/dom/bluetooth/common/webapi/BluetoothObexAuthHandle.cpp
T
roytam1 35abf9a4e9 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1207649: Prepare |BluetoothAddress| for general use throughout Bluetooth code, r=brsun (12c9761458)
- Bug 1207649: Convert Bluetooth Core backend to |BluetoothAddress|, r=brsun (0ca8bca611)
- Bug 1207649: Convert Bluetooth GATT backend to |BluetoothAddress|, r=joliu (baf3aabc35)
- Bug 1202386: Output clear Bluetooth IPC errors, r=shuang (805c1b886d)
- Bug 1204497: Interpret AVRCP remote features as bitmask, r=shuang (858bfc85f0)
- Bug 1207649: Remove obsolete string/address conversion from Bluetooth backend, r=brsun (18fc742a39)
- Bug 1209469: Expose |BluetoothAclState| in Bluetooth backend interface, r=brsun (452a5d8c4c)
- Bug 1209469: Expose |BluetoothPinCode| in Bluetooth backend interface, r=brsun (98d5c8489b)
- Bug 1186331: Check for \0 when parsing Bluetooth device names, r=btian (a4559805f7)
- Bug 1209469: Expose |BluetoothRemoteName| in Bluetooth backend interface, r=brsun (427212ca62)
- Bug 1209469: Expose |BluetoothServiceName| in Bluetooth backend interface, r=brsun (088cb2544e)
- Bug 1211948: Add interface class for Setup module to Bluetooth backend interface, r=brsun (4e1163d509)
- Bug 1203821 - [01] Add utility functions to convert big/little endianness and revise BluetoothPbapManager accordingly, r=shuang (34bcf3a373)
- Bug 1212729 - Handle illegal PBAP virtual folders path properly. r=btian (eaf1f9092b)
- Bug 1212725 - Convert relative paths of PBAP PullvCardListing to absolute path. r=btian (d2862cd8ac)
- Bug 1203821 - [02] Notify gaia of PBAP request with one integrated function, f=jaliu, r=shuang (c2e875b0f7)
- Bug 1215525: Update |BluetoothUuid| structure with c'tors and helper methods, r=brsun (44697b02d6)
- Bug 1221326 - use Endian.h more widely in bluetooth code; r=btian (94217af081)
- Bug 1166675 - Implement GetMessagesListing function, r=btian (e743afc62e)
- Bug 1166679 - Implement GetMessage function, r=btian (bf6c108a69)
- Bug 1186836 - Implement SetMessageStatus function, r=btian (2e163d29fd)
- Bug 1195710 - [MAP]Implement PushMessage function, r=btian (0efcf6dd0e)
- Bug 1166647 - Implement MAP bMessage class, r=btian (90ed64f17e)
- Bug 1184017 - [MAP] Dispatch events to MAP event handlers, r=btian, sr=mrbkap (32289cee15)
- Bug 1168298 - Support OBEX authentication procedure, r=shuang, r=mrbkap (24c07354f6)
- fix misspatch (f173366d27)
- Bug 1208492 - Handle MAP replies from Gaia and pass the results to BluetoothMapSmsManager, r=btian (1230cd8558)
- Bug 1216195 - use mozilla/Endian.h facilities in bluetooth code; r=btian (be77bb24a0)
- Bug 1207649: Convert Bluetooth A2DP backend to |BluetoothAddress|, r=shuang (30b71ac118)
- Bug 1202060: Store Bluetooth profile controller while (dis-)connecting AVRCP, r=shuang (0247a6db65)
- Bug 1204497: Complete AVRCP connect/disconnect from separate runnables, r=shuang (800a85b6dc)
- Bug 1207649: Convert Bluetooth Socket backend to |BluetoothAddress|, r=brsun (05c10fe2e0)
- Bug 1189315 - Add daemon interface for HFP WBS callback. r=tzimmermann (d60a8014d4)
- Bug 1207649: Convert Bluetooth Handsfree backend to |BluetoothAddress|, r=brsun (770e2a5ec2)
- Bug 1215525: Replace strings with Bluetooth addresses and UUIDs in Bluetooth mid-layer, r=brsun (e9409a5f08)
- Bug 1211769 - [MAP] Pack MAP replies to OBEX response packets, r=btain, sr=mrbkap (cbd72a044d)
- Bug 1226063 - take advantage of UniquePtr in BluetoothMapSmsManager::SendMasObexData; r=btian (80ea6465e8)
- Bug 1217339 - Fix illegal format of folder-listing object, r=btian (47739df63a)
- Bug 1221547 - part 1 - enable UnixSocketRawData to take ownership of a passed-in-buffer; r=tzimmerman (6971f7d47d)
- Bug 1207011 - Send Bluetooth OBEX End-of-Body header individually to improve the compatibility with other devices. r=btian (91164179a7)
- Bug 1221547 - part 2 - copy less data for file transfers over bluetooth; r=btian (5f87b8e38e)
- Bug 1203821 - [03] Restore missing bug 1212729 change, r=shuang (d0f384e58f)
- Bug 1218295 - Convert the relative path of PullvCardEntry to absolute path if PBAP request isn't using X-BT-UID. r=btian (6d88b2aa02)
- Bug 1221898 - Fix PBAP memory leakage, r=brsun (47735ba5b8)
- Bug 1224109 - [PBAP] Return early if OBEX authentication password is empty, r=shuang (dd2eab446b)
2023-01-14 11:31:20 +08:00

97 lines
2.7 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#include "BluetoothCommon.h"
#include "BluetoothDevice.h"
#include "BluetoothObexAuthHandle.h"
#include "BluetoothReplyRunnable.h"
#include "BluetoothService.h"
#include "mozilla/dom/BluetoothObexAuthHandleBinding.h"
#include "mozilla/dom/Promise.h"
using namespace mozilla;
using namespace dom;
USING_BLUETOOTH_NAMESPACE
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(BluetoothObexAuthHandle, mOwner)
NS_IMPL_CYCLE_COLLECTING_ADDREF(BluetoothObexAuthHandle)
NS_IMPL_CYCLE_COLLECTING_RELEASE(BluetoothObexAuthHandle)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BluetoothObexAuthHandle)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
BluetoothObexAuthHandle::BluetoothObexAuthHandle(nsPIDOMWindow* aOwner)
: mOwner(aOwner)
{
MOZ_ASSERT(aOwner);
}
BluetoothObexAuthHandle::~BluetoothObexAuthHandle()
{
}
already_AddRefed<BluetoothObexAuthHandle>
BluetoothObexAuthHandle::Create(nsPIDOMWindow* aOwner)
{
MOZ_ASSERT(aOwner);
RefPtr<BluetoothObexAuthHandle> handle =
new BluetoothObexAuthHandle(aOwner);
return handle.forget();
}
already_AddRefed<Promise>
BluetoothObexAuthHandle::SetPassword(const nsAString& aPassword, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
if (!global) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
bs->SetObexPassword(aPassword,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
already_AddRefed<Promise>
BluetoothObexAuthHandle::Reject(ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
if (!global) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
bs->RejectObexAuth(new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
JSObject*
BluetoothObexAuthHandle::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return BluetoothObexAuthHandleBinding::Wrap(aCx, this, aGivenProto);
}