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

// Copyright 2016 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/payments_validators.h"

#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_address_errors.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_payer_errors.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_payment_validation_errors.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_regexp.h"
#include "third_party/blink/renderer/platform/bindings/string_resource.h"
#include "third_party/blink/renderer/platform/bindings/to_blink_string.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/weborigin/security_policy.h"
#include "third_party/blink/renderer/platform/wtf/text/string_impl.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

namespace blink {

// Passing a giant string through IPC to the browser can cause a crash due to
// failure in memory allocation. This number here is chosen conservatively.
static constexpr size_t kMaximumStringLength =;

bool PaymentsValidators::IsValidCurrencyCodeFormat(
    v8::Isolate* isolate,
    const String& code,
    String* optional_error_message) {}

bool PaymentsValidators::IsValidAmountFormat(v8::Isolate* isolate,
                                             const String& amount,
                                             const String& item_name,
                                             String* optional_error_message) {}

bool PaymentsValidators::IsValidCountryCodeFormat(
    v8::Isolate* isolate,
    const String& code,
    String* optional_error_message) {}

bool PaymentsValidators::IsValidShippingAddress(
    v8::Isolate* isolate,
    const payments::mojom::blink::PaymentAddressPtr& address,
    String* optional_error_message) {}

bool PaymentsValidators::IsValidErrorMsgFormat(const String& error,
                                               String* optional_error_message) {}

// static
bool PaymentsValidators::IsValidAddressErrorsFormat(
    const AddressErrors* errors,
    String* optional_error_message) {}

// static
bool PaymentsValidators::IsValidPayerErrorsFormat(
    const PayerErrors* errors,
    String* optional_error_message) {}

// static
bool PaymentsValidators::IsValidPaymentValidationErrorsFormat(
    const PaymentValidationErrors* errors,
    String* optional_error_message) {}

bool PaymentsValidators::IsValidMethodFormat(v8::Isolate* isolate,
                                             const String& identifier) {}

void PaymentsValidators::ValidateAndStringifyObject(
    v8::Isolate* isolate,
    const ScriptValue& input,
    String& output,
    ExceptionState& exception_state) {}

}  // namespace blink