#include "third_party/blink/renderer/modules/nfc/ndef_record.h"
#include <string_view>
#include "base/containers/contains.h"
#include "base/notreached.h"
#include "services/device/public/mojom/nfc.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/idl_types.h"
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_typedefs.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_arraybuffer_arraybufferview.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_message_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_record_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_typedefs.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_piece.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_data_view.h"
#include "third_party/blink/renderer/modules/nfc/ndef_message.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/network/http_parsers.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h"
#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "v8/include/v8.h"
namespace blink {
namespace {
WTF::Vector<uint8_t> GetUTF8DataFromString(const String& string) { … }
v8::Local<v8::Value> GetPayloadDataOrUndefined(
v8::Isolate* isolate,
const NDEFRecordInit& record_init) { … }
bool MaybeIsBufferSource(const ScriptValue& script_value) { … }
bool GetBytesOfBufferSource(const V8BufferSource* buffer_source,
WTF::Vector<uint8_t>* target,
ExceptionState& exception_state) { … }
bool IsValidExternalType(const String& input) { … }
bool IsValidLocalType(const String& input) { … }
String getDocumentLanguage(const ExecutionContext* execution_context) { … }
static NDEFRecord* CreateTextRecord(const ScriptState* script_state,
const String& id,
const NDEFRecordInit& record,
ExceptionState& exception_state) { … }
NDEFRecord* CreateUrlRecord(const ScriptState* script_state,
const String& id,
const NDEFRecordInit& record,
ExceptionState& exception_state) { … }
NDEFRecord* CreateMimeRecord(const ScriptState* script_state,
const String& id,
const NDEFRecordInit& record,
ExceptionState& exception_state) { … }
NDEFRecord* CreateUnknownRecord(const ScriptState* script_state,
const String& id,
const NDEFRecordInit& record,
ExceptionState& exception_state) { … }
NDEFRecord* CreateSmartPosterRecord(const ScriptState* script_state,
const String& id,
const NDEFRecordInit& record,
uint8_t records_depth,
ExceptionState& exception_state) { … }
NDEFRecord* CreateExternalRecord(const ScriptState* script_state,
const String& id,
const NDEFRecordInit& record,
uint8_t records_depth,
ExceptionState& exception_state) { … }
NDEFRecord* CreateLocalRecord(const ScriptState* script_state,
const String& id,
const NDEFRecordInit& record,
uint8_t records_depth,
ExceptionState& exception_state) { … }
}
NDEFRecord* NDEFRecord::CreateForBindings(const ScriptState* script_state,
const NDEFRecordInit* record,
ExceptionState& exception_state) { … }
NDEFRecord* NDEFRecord::Create(const ScriptState* script_state,
const NDEFRecordInit* record,
ExceptionState& exception_state,
uint8_t records_depth,
bool is_embedded) { … }
NDEFRecord::NDEFRecord(device::mojom::blink::NDEFRecordTypeCategory category,
const String& record_type,
const String& id,
WTF::Vector<uint8_t> data)
: … { … }
NDEFRecord::NDEFRecord(device::mojom::blink::NDEFRecordTypeCategory category,
const String& record_type,
const String& id,
NDEFMessage* payload_message)
: … { … }
NDEFRecord::NDEFRecord(const String& id,
const String& encoding,
const String& lang,
WTF::Vector<uint8_t> data)
: … { … }
NDEFRecord::NDEFRecord(const ScriptState* script_state, const String& text)
: … { … }
NDEFRecord::NDEFRecord(const String& id,
const String& media_type,
WTF::Vector<uint8_t> data)
: … { … }
NDEFRecord::NDEFRecord(const device::mojom::blink::NDEFRecord& record)
: … { … }
const String& NDEFRecord::mediaType() const { … }
DOMDataView* NDEFRecord::data() const { … }
std::optional<HeapVector<Member<NDEFRecord>>> NDEFRecord::toRecords(
ExceptionState& exception_state) const { … }
void NDEFRecord::Trace(Visitor* visitor) const { … }
}