chromium/third_party/blink/renderer/modules/serial/serial.cc

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

#include "third_party/blink/renderer/modules/serial/serial.h"

#include <inttypes.h>

#include <utility>

#include "base/unguessable_token.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-blink.h"
#include "third_party/blink/public/mojom/serial/serial.mojom-blink.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_serial_port_filter.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_serial_port_request_options.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/execution_context/navigator_base.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/modules/bluetooth/bluetooth_uuid.h"
#include "third_party/blink/renderer/modules/event_target_modules_names.h"
#include "third_party/blink/renderer/modules/serial/serial_port.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"

namespace blink {

namespace {

const char kContextGone[] =;
const char kFeaturePolicyBlocked[] =;
const char kNoPortSelected[] =;

String TokenToString(const base::UnguessableToken& token) {}

// Carries out basic checks for the web-exposed APIs, to make sure the minimum
// requirements for them to be served are met. Returns true if any conditions
// fail to be met, generating an appropriate exception as well. Otherwise,
// returns false to indicate the call should be allowed.
bool ShouldBlockSerialServiceCall(LocalDOMWindow* window,
                                  ExecutionContext* context,
                                  ExceptionState* exception_state) {}

}  // namespace

const char Serial::kSupplementName[] =;

Serial* Serial::serial(NavigatorBase& navigator) {}

Serial::Serial(NavigatorBase& navigator)
    :{}

ExecutionContext* Serial::GetExecutionContext() const {}

const AtomicString& Serial::InterfaceName() const {}

void Serial::ContextDestroyed() {}

void Serial::OnPortConnectedStateChanged(
    mojom::blink::SerialPortInfoPtr port_info) {}

ScriptPromise<IDLSequence<SerialPort>> Serial::getPorts(
    ScriptState* script_state,
    ExceptionState& exception_state) {}

// static
mojom::blink::SerialPortFilterPtr Serial::CreateMojoFilter(
    const SerialPortFilter* filter,
    ExceptionState& exception_state) {}

ScriptPromise<SerialPort> Serial::requestPort(
    ScriptState* script_state,
    const SerialPortRequestOptions* options,
    ExceptionState& exception_state) {}

void Serial::OpenPort(
    const base::UnguessableToken& token,
    device::mojom::blink::SerialConnectionOptionsPtr options,
    mojo::PendingRemote<device::mojom::blink::SerialPortClient> client,
    mojom::blink::SerialService::OpenPortCallback callback) {}

void Serial::ForgetPort(
    const base::UnguessableToken& token,
    mojom::blink::SerialService::ForgetPortCallback callback) {}

void Serial::Trace(Visitor* visitor) const {}

void Serial::AddedEventListener(const AtomicString& event_type,
                                RegisteredEventListener& listener) {}

void Serial::EnsureServiceConnection() {}

void Serial::OnServiceConnectionError() {}

SerialPort* Serial::GetOrCreatePort(mojom::blink::SerialPortInfoPtr info) {}

void Serial::OnGetPorts(
    ScriptPromiseResolver<IDLSequence<SerialPort>>* resolver,
    Vector<mojom::blink::SerialPortInfoPtr> port_infos) {}

void Serial::OnRequestPort(ScriptPromiseResolver<SerialPort>* resolver,
                           mojom::blink::SerialPortInfoPtr port_info) {}

}  // namespace blink