chromium/third_party/blink/renderer/modules/nfc/ndef_reader.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 "third_party/blink/renderer/modules/nfc/ndef_reader.h"

#include <memory>

#include "services/device/public/mojom/nfc.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_make_read_only_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_scan_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_write_options.h"
#include "third_party/blink/renderer/core/dom/abort_signal.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/scoped_abort_state.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/inspector/console_message.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/modules/nfc/ndef_message.h"
#include "third_party/blink/renderer/modules/nfc/ndef_reading_event.h"
#include "third_party/blink/renderer/modules/nfc/nfc_proxy.h"
#include "third_party/blink/renderer/modules/nfc/nfc_type_converters.h"
#include "third_party/blink/renderer/modules/permissions/permission_utils.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h"

namespace blink {

PermissionName;
PermissionService;

namespace {

v8::Local<v8::Value> NDEFErrorTypeToDOMException(
    v8::Isolate* isolate,
    device::mojom::blink::NDEFErrorType error_type,
    const String& error_message) {}

v8::Local<v8::Value> NDEFErrorPtrToDOMException(
    v8::Isolate* isolate,
    device::mojom::blink::NDEFErrorPtr error) {}

constexpr char kNotSupportedOrPermissionDenied[] =;

constexpr char kChildFrameErrorMessage[] =;

}  // namespace

class NDEFReader::ReadAbortAlgorithm final : public AbortSignal::Algorithm {};

class NDEFReader::WriteAbortAlgorithm final : public AbortSignal::Algorithm {};

class NDEFReader::MakeReadOnlyAbortAlgorithm final
    : public AbortSignal::Algorithm {};

// static
NDEFReader* NDEFReader::Create(ExecutionContext* context) {}

NDEFReader::NDEFReader(ExecutionContext* context)
    :{}

NDEFReader::~NDEFReader() = default;

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

ExecutionContext* NDEFReader::GetExecutionContext() const {}

bool NDEFReader::HasPendingActivity() const {}

// https://w3c.github.io/web-nfc/#the-scan-method
ScriptPromise<IDLUndefined> NDEFReader::scan(ScriptState* script_state,
                                             const NDEFScanOptions* options,
                                             ExceptionState& exception_state) {}

void NDEFReader::ReadOnRequestPermission(
    const NDEFScanOptions* options,
    mojom::blink::PermissionStatus status) {}

void NDEFReader::ReadOnRequestCompleted(
    device::mojom::blink::NDEFErrorPtr error) {}

void NDEFReader::OnReading(const String& serial_number,
                           const device::mojom::blink::NDEFMessage& message) {}

void NDEFReader::OnReadingError(const String& message) {}

void NDEFReader::ContextDestroyed() {}

void NDEFReader::ReadAbort(AbortSignal* signal) {}

// https://w3c.github.io/web-nfc/#writing-content
// https://w3c.github.io/web-nfc/#the-write-method
ScriptPromise<IDLUndefined> NDEFReader::write(
    ScriptState* script_state,
    const V8NDEFMessageSource* write_message,
    const NDEFWriteOptions* options,
    ExceptionState& exception_state) {}

void NDEFReader::WriteOnRequestPermission(
    ScriptPromiseResolver<IDLUndefined>* resolver,
    std::unique_ptr<ScopedAbortState> scoped_abort_state,
    const NDEFWriteOptions* options,
    device::mojom::blink::NDEFMessagePtr message,
    mojom::blink::PermissionStatus status) {}

void NDEFReader::WriteOnRequestCompleted(
    ScriptPromiseResolver<IDLUndefined>* resolver,
    std::unique_ptr<ScopedAbortState> scoped_abort_state,
    device::mojom::blink::NDEFErrorPtr error) {}

void NDEFReader::WriteAbort() {}

ScriptPromise<IDLUndefined> NDEFReader::makeReadOnly(
    ScriptState* script_state,
    const NDEFMakeReadOnlyOptions* options,
    ExceptionState& exception_state) {}

void NDEFReader::MakeReadOnlyOnRequestPermission(
    ScriptPromiseResolver<IDLUndefined>* resolver,
    std::unique_ptr<ScopedAbortState> scoped_abort_state,
    const NDEFMakeReadOnlyOptions* options,
    mojom::blink::PermissionStatus status) {}

void NDEFReader::MakeReadOnlyOnRequestCompleted(
    ScriptPromiseResolver<IDLUndefined>* resolver,
    std::unique_ptr<ScopedAbortState> scoped_abort_state,
    device::mojom::blink::NDEFErrorPtr error) {}

void NDEFReader::MakeReadOnlyAbort() {}

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

PermissionService* NDEFReader::GetPermissionService() {}

void NDEFReader::ReadOnMojoConnectionError() {}

void NDEFReader::WriteOnMojoConnectionError() {}

void NDEFReader::MakeReadOnlyOnMojoConnectionError() {}

}  // namespace blink