87f7625c5d
* chore: bump chromium in DEPS to 96.0.4662.0 * chore: bump chromium in DEPS to 96.0.4663.0 * chore: update patches * [Extensions] Remove RuntimeData entirely https://chromium-review.googlesource.com/c/chromium/src/+/3177328 * Make helper macros behave consistently for //content/public UserData types https://chromium-review.googlesource.com/c/chromium/src/+/3198788 * Enabling sandboxing for the speech recognition service browser tests https://chromium-review.googlesource.com/c/chromium/src/+/3146090 * [devtools] Add 'RegisterPreference' host binding https://chromium-review.googlesource.com/c/chromium/src/+/3162281 * [Reland][Extensions]: Add persistAcrossSessions flag (scripting API) https://chromium-review.googlesource.com/c/chromium/src/+/3175161 * [Bluetooth] Add Passkey prompt dialog for bonding. https://chromium-review.googlesource.com/c/chromium/src/+/2841104 * Clipboard: Remove ReadImage path in browser https://chromium-review.googlesource.com/c/chromium/src/+/3194826 * Split printing metafile code into its own target. https://chromium-review.googlesource.com/c/chromium/src/+/3164925 * Cleanup unused DesktopMediaListObserver params https://chromium-review.googlesource.com/c/chromium/src/+/3179203 * Remove base::DictionaryValue::GetBinary https://chromium-review.googlesource.com/c/chromium/src/+/3201974 * Window Placement: change RWHV::GetDisplayList to GetScreenInfos https://chromium-review.googlesource.com/c/chromium/src/+/3138774 * Add a preview to the Tab Capture picker dialog https://chromium-review.googlesource.com/c/chromium/src/+/3045268 * Add service-based usage to update print settings https://chromium-review.googlesource.com/c/chromium/src/+/3155426 * chore: bump chromium in DEPS to 96.0.4664.2 * chore: update patches * chore: bump chromium in DEPS to 96.0.4664.4 * chore: update patches * chore: bump chromium in DEPS to 97.0.4666.0 * Revert "chore: bump chromium in DEPS to 97.0.4666.0" This reverts commit d73caae8ba4b39efc9b3ea4de52685b9c92ef3d0. * Reland "Block external protocol handler with sandbox." https://chromium-review.googlesource.com/c/chromium/src/+/3198263 * fixup for lint * Add CookiePartitionKeychain parameter to CookeManager.GetCookieList. https://chromium-review.googlesource.com/c/chromium/src/+/3206016 * Move ui/gfx/transform*,rrect*,mask_filter_info* into ui/gfx/geometry https://chromium-review.googlesource.com/c/chromium/src/+/3200392 * fixup Move ui/gfx/transform*,rrect*,mask_filter_info* into ui/gfx/geometry * ozone: //chrome/browser clean up from USE_X11 https://chromium-review.googlesource.com/c/chromium/src/+/3186490 * content: don't load v8 snapshot in browser process https://chromium-review.googlesource.com/c/chromium/src/+/3183394 * [devtools] Add 'RegisterPreference' host binding https://chromium-review.googlesource.com/c/chromium/src/+/3162281 * 3186491: Add 'devtools.sync_preferences' preference https://chromium-review.googlesource.com/c/chromium/src/+/3186491 * 2951147: DCHECK accessible names for focusable Views https://chromium-review.googlesource.com/c/chromium/src/+/2951147 * 3201014: Use real font size for calculation of SmallTextRatio https://chromium-review.googlesource.com/c/chromium/src/+/3201014 * fixup Clipboard: Remove ReadImage path in browser * chore: update patches * fix: disable PlzServiceWorker to fix custom protocol SW script loading Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3199761 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
135 lines
4.1 KiB
C++
135 lines
4.1 KiB
C++
// Copyright (c) 2020 Microsoft, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/browser/bluetooth/electron_bluetooth_delegate.h"
|
|
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
#include "base/strings/utf_string_conversions.h"
|
|
#include "build/build_config.h"
|
|
#include "content/public/browser/render_frame_host.h"
|
|
#include "content/public/browser/web_contents.h"
|
|
#include "device/bluetooth/bluetooth_device.h"
|
|
#include "device/bluetooth/public/cpp/bluetooth_uuid.h"
|
|
#include "shell/browser/api/electron_api_web_contents.h"
|
|
#include "shell/browser/lib/bluetooth_chooser.h"
|
|
#include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h"
|
|
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
|
|
|
|
using blink::WebBluetoothDeviceId;
|
|
using content::RenderFrameHost;
|
|
using content::WebContents;
|
|
using device::BluetoothUUID;
|
|
|
|
namespace electron {
|
|
|
|
ElectronBluetoothDelegate::ElectronBluetoothDelegate() = default;
|
|
|
|
ElectronBluetoothDelegate::~ElectronBluetoothDelegate() = default;
|
|
|
|
std::unique_ptr<content::BluetoothChooser>
|
|
ElectronBluetoothDelegate::RunBluetoothChooser(
|
|
content::RenderFrameHost* frame,
|
|
const content::BluetoothChooser::EventHandler& event_handler) {
|
|
auto* api_web_contents =
|
|
api::WebContents::From(content::WebContents::FromRenderFrameHost(frame));
|
|
return std::make_unique<BluetoothChooser>(api_web_contents, event_handler);
|
|
}
|
|
|
|
// The following methods are not currently called in Electron.
|
|
std::unique_ptr<content::BluetoothScanningPrompt>
|
|
ElectronBluetoothDelegate::ShowBluetoothScanningPrompt(
|
|
content::RenderFrameHost* frame,
|
|
const content::BluetoothScanningPrompt::EventHandler& event_handler) {
|
|
NOTIMPLEMENTED();
|
|
return nullptr;
|
|
}
|
|
|
|
void ElectronBluetoothDelegate::ShowDeviceCredentialsPrompt(
|
|
content::RenderFrameHost* frame,
|
|
const std::u16string& device_identifier,
|
|
CredentialsCallback callback) {
|
|
// TODO(jkleinsc) implement this
|
|
std::move(callback).Run(DeviceCredentialsPromptResult::kCancelled, u"");
|
|
}
|
|
|
|
WebBluetoothDeviceId ElectronBluetoothDelegate::GetWebBluetoothDeviceId(
|
|
RenderFrameHost* frame,
|
|
const std::string& device_address) {
|
|
NOTIMPLEMENTED();
|
|
return WebBluetoothDeviceId::Create();
|
|
}
|
|
|
|
std::string ElectronBluetoothDelegate::GetDeviceAddress(
|
|
RenderFrameHost* frame,
|
|
const WebBluetoothDeviceId& device_id) {
|
|
NOTIMPLEMENTED();
|
|
return nullptr;
|
|
}
|
|
|
|
WebBluetoothDeviceId ElectronBluetoothDelegate::AddScannedDevice(
|
|
RenderFrameHost* frame,
|
|
const std::string& device_address) {
|
|
NOTIMPLEMENTED();
|
|
return WebBluetoothDeviceId::Create();
|
|
}
|
|
|
|
WebBluetoothDeviceId ElectronBluetoothDelegate::GrantServiceAccessPermission(
|
|
RenderFrameHost* frame,
|
|
const device::BluetoothDevice* device,
|
|
const blink::mojom::WebBluetoothRequestDeviceOptions* options) {
|
|
NOTIMPLEMENTED();
|
|
return WebBluetoothDeviceId::Create();
|
|
}
|
|
|
|
bool ElectronBluetoothDelegate::HasDevicePermission(
|
|
RenderFrameHost* frame,
|
|
const WebBluetoothDeviceId& device_id) {
|
|
NOTIMPLEMENTED();
|
|
return true;
|
|
}
|
|
|
|
bool ElectronBluetoothDelegate::IsAllowedToAccessService(
|
|
RenderFrameHost* frame,
|
|
const WebBluetoothDeviceId& device_id,
|
|
const BluetoothUUID& service) {
|
|
NOTIMPLEMENTED();
|
|
return true;
|
|
}
|
|
|
|
bool ElectronBluetoothDelegate::IsAllowedToAccessAtLeastOneService(
|
|
RenderFrameHost* frame,
|
|
const WebBluetoothDeviceId& device_id) {
|
|
NOTIMPLEMENTED();
|
|
return true;
|
|
}
|
|
|
|
bool ElectronBluetoothDelegate::IsAllowedToAccessManufacturerData(
|
|
RenderFrameHost* frame,
|
|
const WebBluetoothDeviceId& device_id,
|
|
uint16_t manufacturer_code) {
|
|
NOTIMPLEMENTED();
|
|
return true;
|
|
}
|
|
|
|
void ElectronBluetoothDelegate::AddFramePermissionObserver(
|
|
FramePermissionObserver* observer) {
|
|
NOTIMPLEMENTED();
|
|
}
|
|
|
|
void ElectronBluetoothDelegate::RemoveFramePermissionObserver(
|
|
FramePermissionObserver* observer) {
|
|
NOTIMPLEMENTED();
|
|
}
|
|
|
|
std::vector<blink::mojom::WebBluetoothDevicePtr>
|
|
ElectronBluetoothDelegate::GetPermittedDevices(
|
|
content::RenderFrameHost* frame) {
|
|
std::vector<blink::mojom::WebBluetoothDevicePtr> permitted_devices;
|
|
NOTIMPLEMENTED();
|
|
return permitted_devices;
|
|
}
|
|
|
|
} // namespace electron
|