#include "third_party/blink/renderer/modules/smart_card/smart_card_context.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_smart_card_connect_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_smart_card_connect_result.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_smart_card_get_status_change_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_smart_card_reader_state_flags_in.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_smart_card_reader_state_flags_out.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_smart_card_reader_state_in.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_smart_card_reader_state_out.h"
#include "third_party/blink/renderer/modules/smart_card/smart_card_cancel_algorithm.h"
#include "third_party/blink/renderer/modules/smart_card/smart_card_connection.h"
#include "third_party/blink/renderer/modules/smart_card/smart_card_error.h"
#include "third_party/blink/renderer/modules/smart_card/smart_card_util.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
namespace blink {
namespace {
constexpr char kContextUnavailable[] = …;
constexpr char kContextBusy[] = …;
device::mojom::blink::SmartCardReaderStateFlagsPtr ToMojomStateFlags(
const SmartCardReaderStateFlagsIn& flags) { … }
Vector<device::mojom::blink::SmartCardReaderStateInPtr> ToMojomReaderStatesIn(
const HeapVector<Member<SmartCardReaderStateIn>>& reader_states) { … }
SmartCardReaderStateFlagsOut* ToV8ReaderStateFlagsOut(
const device::mojom::blink::SmartCardReaderStateFlags& mojom_state_flags) { … }
HeapVector<Member<SmartCardReaderStateOut>> ToV8ReaderStatesOut(
Vector<device::mojom::blink::SmartCardReaderStateOutPtr>&
mojom_reader_states) { … }
}
SmartCardContext::SmartCardContext(
mojo::PendingRemote<device::mojom::blink::SmartCardContext> pending_context,
ExecutionContext* execution_context)
: … { … }
ScriptPromise<IDLSequence<IDLString>> SmartCardContext::listReaders(
ScriptState* script_state,
ExceptionState& exception_state) { … }
ScriptPromise<IDLSequence<SmartCardReaderStateOut>>
SmartCardContext::getStatusChange(
ScriptState* script_state,
const HeapVector<Member<SmartCardReaderStateIn>>& reader_states,
SmartCardGetStatusChangeOptions* options,
ExceptionState& exception_state) { … }
ScriptPromise<SmartCardConnectResult> SmartCardContext::connect(
ScriptState* script_state,
const String& reader_name,
V8SmartCardAccessMode access_mode,
SmartCardConnectOptions* options,
ExceptionState& exception_state) { … }
void SmartCardContext::Trace(Visitor* visitor) const { … }
void SmartCardContext::Cancel() { … }
bool SmartCardContext::EnsureNoOperationInProgress(
ExceptionState& exception_state) const { … }
void SmartCardContext::SetConnectionOperationInProgress(
ScriptPromiseResolverBase* resolver) { … }
void SmartCardContext::SetOperationInProgress(
ScriptPromiseResolverBase* resolver) { … }
void SmartCardContext::ClearConnectionOperationInProgress(
ScriptPromiseResolverBase* resolver) { … }
void SmartCardContext::ClearOperationInProgress(
ScriptPromiseResolverBase* resolver) { … }
bool SmartCardContext::IsOperationInProgress() const { … }
void SmartCardContext::CloseMojoConnection() { … }
bool SmartCardContext::EnsureMojoConnection(
ExceptionState& exception_state) const { … }
void SmartCardContext::OnListReadersDone(
ScriptPromiseResolver<IDLSequence<IDLString>>* resolver,
device::mojom::blink::SmartCardListReadersResultPtr result) { … }
void SmartCardContext::OnGetStatusChangeDone(
ScriptPromiseResolver<IDLSequence<SmartCardReaderStateOut>>* resolver,
AbortSignal* signal,
AbortSignal::AlgorithmHandle* abort_handle,
device::mojom::blink::SmartCardStatusChangeResultPtr result) { … }
void SmartCardContext::OnCancelDone(
device::mojom::blink::SmartCardResultPtr result) { … }
void SmartCardContext::OnConnectDone(
ScriptPromiseResolver<SmartCardConnectResult>* resolver,
device::mojom::blink::SmartCardConnectResultPtr result) { … }
}