chromium/extensions/browser/api/device_permissions_prompt.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/browser/api/device_permissions_prompt.h"

#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/i18n/message_formatter.h"
#include "base/memory/scoped_refptr.h"
#include "base/no_destructor.h"
#include "base/ranges/algorithm.h"
#include "base/scoped_observation.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/device_service.h"
#include "extensions/browser/api/device_permissions_manager.h"
#include "extensions/browser/api/usb/usb_device_manager.h"
#include "extensions/common/extension.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/cpp/hid/hid_device_filter.h"
#include "services/device/public/cpp/hid/hid_report_utils.h"
#include "services/device/public/cpp/usb/usb_utils.h"
#include "services/device/public/mojom/usb_enumeration_options.mojom.h"
#include "ui/base/l10n/l10n_util.h"

#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/dbus/permission_broker/permission_broker_client.h"  // nogncheck
#endif  // BUILDFLAG(IS_CHROMEOS)

HidDeviceFilter;
UsbDeviceFilterPtr;

namespace extensions {

namespace {

class UsbDeviceInfo : public DevicePermissionsPrompt::Prompt::DeviceInfo {};

class UsbDevicePermissionsPrompt : public DevicePermissionsPrompt::Prompt,
                                   public UsbDeviceManager::Observer {};

class HidDeviceInfo : public DevicePermissionsPrompt::Prompt::DeviceInfo {};

DevicePermissionsPrompt::HidManagerBinder& GetHidManagerBinderOverride() {}

class HidDevicePermissionsPrompt : public DevicePermissionsPrompt::Prompt,
                                   public device::mojom::HidManagerClient {};

}  // namespace

DevicePermissionsPrompt::Prompt::DeviceInfo::DeviceInfo() {}

DevicePermissionsPrompt::Prompt::DeviceInfo::~DeviceInfo() {}

DevicePermissionsPrompt::Prompt::Observer::~Observer() {}

DevicePermissionsPrompt::Prompt::Prompt(const Extension* extension,
                                        content::BrowserContext* context,
                                        bool multiple)
    :{}

void DevicePermissionsPrompt::Prompt::SetObserver(Observer* observer) {}

std::u16string DevicePermissionsPrompt::Prompt::GetDeviceName(
    size_t index) const {}

std::u16string DevicePermissionsPrompt::Prompt::GetDeviceSerialNumber(
    size_t index) const {}

void DevicePermissionsPrompt::Prompt::GrantDevicePermission(size_t index) {}

DevicePermissionsPrompt::Prompt::~Prompt() {}

void DevicePermissionsPrompt::Prompt::AddDevice(
    std::unique_ptr<DeviceInfo> device) {}

DevicePermissionsPrompt::DevicePermissionsPrompt(
    content::WebContents* web_contents)
    :{}

DevicePermissionsPrompt::~DevicePermissionsPrompt() {}

void DevicePermissionsPrompt::AskForUsbDevices(
    const Extension* extension,
    content::BrowserContext* context,
    bool multiple,
    std::vector<UsbDeviceFilterPtr> filters,
    UsbDevicesCallback callback) {}

void DevicePermissionsPrompt::AskForHidDevices(
    const Extension* extension,
    content::BrowserContext* context,
    bool multiple,
    const std::vector<HidDeviceFilter>& filters,
    HidDevicesCallback callback) {}

// static
scoped_refptr<DevicePermissionsPrompt::Prompt>
DevicePermissionsPrompt::CreateHidPromptForTest(const Extension* extension,
                                                bool multiple) {}

// static
scoped_refptr<DevicePermissionsPrompt::Prompt>
DevicePermissionsPrompt::CreateUsbPromptForTest(const Extension* extension,
                                                bool multiple) {}

// static
void DevicePermissionsPrompt::OverrideHidManagerBinderForTesting(
    HidManagerBinder binder) {}

}  // namespace extensions