feat: add support for Web Bluetooth pin pairing (#35416)
* feat: add bluetooth pairing handler * Update docs/api/session.md Co-authored-by: Charles Kerr <charles@charleskerr.com> * Update docs/api/session.md Co-authored-by: Charles Kerr <charles@charleskerr.com> * docs: update based on review * Apply suggestions from code review Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Charles Kerr <charles@charleskerr.com> * chore: update docs per review * chore: cleanup callback per review Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Erick Zhao <erick@hotmail.ca>
This commit is contained in:
parent
f8077cc004
commit
697a219bcb
11 changed files with 234 additions and 6 deletions
|
@ -130,6 +130,11 @@ void ElectronPermissionManager::SetDevicePermissionHandler(
|
|||
device_permission_handler_ = handler;
|
||||
}
|
||||
|
||||
void ElectronPermissionManager::SetBluetoothPairingHandler(
|
||||
const BluetoothPairingHandler& handler) {
|
||||
bluetooth_pairing_handler_ = handler;
|
||||
}
|
||||
|
||||
void ElectronPermissionManager::RequestPermission(
|
||||
blink::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
|
@ -276,6 +281,18 @@ ElectronPermissionManager::SubscribePermissionStatusChange(
|
|||
void ElectronPermissionManager::UnsubscribePermissionStatusChange(
|
||||
SubscriptionId id) {}
|
||||
|
||||
void ElectronPermissionManager::CheckBluetoothDevicePair(
|
||||
gin_helper::Dictionary details,
|
||||
PairCallback pair_callback) const {
|
||||
if (bluetooth_pairing_handler_.is_null()) {
|
||||
base::Value::Dict response;
|
||||
response.Set("confirmed", false);
|
||||
std::move(pair_callback).Run(std::move(response));
|
||||
} else {
|
||||
bluetooth_pairing_handler_.Run(details, std::move(pair_callback));
|
||||
}
|
||||
}
|
||||
|
||||
bool ElectronPermissionManager::CheckPermissionWithDetails(
|
||||
blink::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue