chromium/third_party/blink/renderer/modules/payments/payment_instruments.cc

// Copyright 2017 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/payments/payment_instruments.h"

#include <utility>

#include "base/location.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_icon_sizes_parser.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/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_image_object.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_payment_instrument.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/security_context.h"
#include "third_party/blink/renderer/core/frame/frame.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/payments/payment_manager.h"
#include "third_party/blink/renderer/modules/permissions/permission_utils.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"

namespace blink {
namespace {

// Maximum size of a PaymentInstrument icon's type when passed over mojo.
const size_t kMaxTypeLength =;

static const char kPaymentManagerUnavailable[] =;

template <typename IDLType>
bool rejectError(ScriptPromiseResolver<IDLType>* resolver,
                 payments::mojom::blink::PaymentHandlerStatus status) {}

bool AllowedToUsePaymentFeatures(ScriptState* script_state) {}

void ThrowNotAllowedToUsePaymentFeatures(ExceptionState& exception_state) {}

ScriptPromise<IDLUndefined> RejectNotAllowedToUsePaymentFeatures(
    ScriptState* script_state,
    ExceptionState& exception_state) {}

}  // namespace

PaymentInstruments::PaymentInstruments(const PaymentManager& payment_manager,
                                       ExecutionContext* context)
    :{}

ScriptPromise<IDLBoolean> PaymentInstruments::deleteInstrument(
    ScriptState* script_state,
    const String& instrument_key,
    ExceptionState& exception_state) {}

ScriptPromise<PaymentInstrument> PaymentInstruments::get(
    ScriptState* script_state,
    const String& instrument_key,
    ExceptionState& exception_state) {}

ScriptPromise<IDLSequence<IDLString>> PaymentInstruments::keys(
    ScriptState* script_state,
    ExceptionState& exception_state) {}

ScriptPromise<IDLBoolean> PaymentInstruments::has(
    ScriptState* script_state,
    const String& instrument_key,
    ExceptionState& exception_state) {}

ScriptPromise<IDLUndefined> PaymentInstruments::set(
    ScriptState* script_state,
    const String& instrument_key,
    const PaymentInstrument* details,
    ExceptionState& exception_state) {}

ScriptPromise<IDLUndefined> PaymentInstruments::clear(
    ScriptState* script_state,
    ExceptionState& exception_state) {}

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

mojom::blink::PermissionService* PaymentInstruments::GetPermissionService(
    ScriptState* script_state) {}

void PaymentInstruments::OnRequestPermission(
    ScriptPromiseResolver<IDLUndefined>* resolver,
    const String& instrument_key,
    const PaymentInstrument* details,
    mojom::blink::PermissionStatus status) {}

void PaymentInstruments::onDeletePaymentInstrument(
    ScriptPromiseResolver<IDLBoolean>* resolver,
    payments::mojom::blink::PaymentHandlerStatus status) {}

void PaymentInstruments::onGetPaymentInstrument(
    ScriptPromiseResolver<PaymentInstrument>* resolver,
    payments::mojom::blink::PaymentInstrumentPtr stored_instrument,
    payments::mojom::blink::PaymentHandlerStatus status) {}

void PaymentInstruments::onKeysOfPaymentInstruments(
    ScriptPromiseResolver<IDLSequence<IDLString>>* resolver,
    const Vector<String>& keys,
    payments::mojom::blink::PaymentHandlerStatus status) {}

void PaymentInstruments::onHasPaymentInstrument(
    ScriptPromiseResolver<IDLBoolean>* resolver,
    payments::mojom::blink::PaymentHandlerStatus status) {}

void PaymentInstruments::onSetPaymentInstrument(
    ScriptPromiseResolver<IDLUndefined>* resolver,
    payments::mojom::blink::PaymentHandlerStatus status) {}

void PaymentInstruments::onClearPaymentInstruments(
    ScriptPromiseResolver<IDLUndefined>* resolver,
    payments::mojom::blink::PaymentHandlerStatus status) {}

}  // namespace blink