chromium/chrome/browser/ui/serial/serial_chooser_controller.cc

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

#include "chrome/browser/ui/serial/serial_chooser_controller.h"

#include <utility>

#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/unguessable_token.h"
#include "chrome/browser/chooser_controller/title_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/serial/serial_blocklist.h"
#include "chrome/browser/serial/serial_chooser_context_factory.h"
#include "chrome/browser/serial/serial_chooser_histograms.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/public/cpp/bluetooth_uuid.h"
#include "services/device/public/cpp/bluetooth/bluetooth_utils.h"
#include "services/device/public/mojom/serial.mojom.h"
#include "ui/base/l10n/l10n_util.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/webui/settings/public/constants/routes.mojom.h"
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
#include "chrome/common/webui_url_constants.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#endif

namespace {

BluetoothAdapter;
BluetoothAdapterFactory;
SerialPortType;

bool FilterMatchesPort(const blink::mojom::SerialPortFilter& filter,
                       const device::mojom::SerialPortInfo& port) {}

bool BluetoothPortIsAllowed(
    const std::vector<::device::BluetoothUUID>& allowed_ids,
    const device::mojom::SerialPortInfo& port) {}

}  // namespace

SerialChooserController::SerialChooserController(
    content::RenderFrameHost* render_frame_host,
    std::vector<blink::mojom::SerialPortFilterPtr> filters,
    std::vector<::device::BluetoothUUID> allowed_bluetooth_service_class_ids,
    content::SerialChooser::Callback callback)
    :{}

SerialChooserController::~SerialChooserController() {}

const device::mojom::SerialPortInfo& SerialChooserController::GetPortForTest(
    size_t index) const {}

void SerialChooserController::GetDevices() {}

bool SerialChooserController::ShouldShowHelpButton() const {}

std::u16string SerialChooserController::GetNoOptionsText() const {}

std::u16string SerialChooserController::GetOkButtonLabel() const {}

std::pair<std::u16string, std::u16string>
SerialChooserController::GetThrobberLabelAndTooltip() const {}

size_t SerialChooserController::NumOptions() const {}

// Does the Bluetooth service class ID need to be displayed along with the
// display name for the provided `port`? The goal is to display the shortest
// name necessary to identify the port. When two (or more) ports from the same
// device are selected, the service class ID is added to disambiguate the two
// ports.
bool SerialChooserController::DisplayServiceClassId(
    const device::mojom::SerialPortInfo& port) const {}

std::u16string SerialChooserController::GetOption(size_t index) const {}

bool SerialChooserController::IsPaired(size_t index) const {}

void SerialChooserController::Select(const std::vector<size_t>& indices) {}

void SerialChooserController::Cancel() {}

void SerialChooserController::Close() {}

// TODO(crbug.com/355570625): Shared impl with ChromeBluetoothChooserController.
void SerialChooserController::OpenAdapterOffHelpUrl() const {}

void SerialChooserController::OpenHelpCenterUrl() const {}

void SerialChooserController::OpenPermissionPreferences() const {}

bool SerialChooserController::ShouldShowAdapterOffView() const {}

int SerialChooserController::GetAdapterOffMessageId() const {}

int SerialChooserController::GetTurnAdapterOnLinkTextMessageId() const {}

bool SerialChooserController::ShouldShowAdapterUnauthorizedView() const {}

int SerialChooserController::GetBluetoothUnauthorizedMessageId() const {}

int SerialChooserController::GetAuthorizeBluetoothLinkTextMessageId() const {}

void SerialChooserController::AdapterPoweredChanged(BluetoothAdapter* adapter,
                                                    bool powered) {}

void SerialChooserController::OnPortAdded(
    const device::mojom::SerialPortInfo& port) {}

void SerialChooserController::OnPortRemoved(
    const device::mojom::SerialPortInfo& port) {}

void SerialChooserController::OnPortManagerConnectionError() {}

void SerialChooserController::OnGetDevices(
    std::vector<device::mojom::SerialPortInfoPtr> ports) {}

bool SerialChooserController::DisplayDevice(
    const device::mojom::SerialPortInfo& port) const {}

void SerialChooserController::AddMessageToConsole(
    blink::mojom::ConsoleMessageLevel level,
    const std::string& message) const {}

void SerialChooserController::RunCallback(
    device::mojom::SerialPortInfoPtr port) {}

void SerialChooserController::OnGetAdapter(
    base::OnceClosure callback,
    scoped_refptr<BluetoothAdapter> adapter) {}

bool SerialChooserController::IsWirelessSerialPortOnly() {}