chromium/components/payments/content/utility/payment_manifest_parser.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 "components/payments/content/utility/payment_manifest_parser.h"

#include <algorithm>
#include <string_view>
#include <utility>

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "components/payments/content/utility/fingerprint_parser.h"
#include "components/payments/core/error_logger.h"
#include "components/payments/core/url_util.h"
#include "net/base/url_util.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "url/url_constants.h"

namespace payments {
namespace {

const size_t kMaximumNumberOfItems =;
const size_t kMaximumNumberOfSupportedOrigins =;
const size_t kMaximumNumberOfSupportedDelegations =;
const size_t kMaximumPrintedStringLength =;

const char* const kDefaultApplications =;
const char* const kFingerprints =;
const char* const kHttpPrefix =;
const char* const kHttpsPrefix =;
const char* const kId =;
const char* const kMinVersion =;
const char* const kPayment =;
const char* const kPlatform =;
const char* const kPlay =;
const char* const kPreferRelatedApplications =;
const char* const kRelatedApplications =;
const char* const kServiceWorkerScope =;
const char* const kServiceWorker =;
const char* const kServiceWorkerSrc =;
const char* const kServiceWorkerUseCache =;
const char* const kSupportedDelegations =;
const char* const kSupportedOrigins =;
const char* const kWebAppIcons =;
const char* const kWebAppIconSizes =;
const char* const kWebAppIconSrc =;
const char* const kWebAppIconType =;
const char* const kWebAppName =;

// Truncates a std::string to 100 chars. This returns an empty string when the
// input should be ASCII but it's not.
const std::string ValidateAndTruncateIfNeeded(const std::string& input,
                                              bool* out_is_ASCII) {}

// Parses the "default_applications": ["https://some/url"] from |dict| into
// |web_app_manifest_urls|. Uses |manifest_url| to resolve relative URLs.
// Returns 'false' for invalid data.
bool ParseDefaultApplications(const GURL& manifest_url,
                              const base::Value::Dict* dict,
                              std::vector<GURL>* web_app_manifest_urls,
                              const ErrorLogger& log) {}

// Parses the "supported_origins": "https://some.origin" from |dict|
// into |supported_origins|. Returns 'false' for invalid data.
bool ParseSupportedOrigins(const base::Value::Dict* dict,
                           std::vector<url::Origin>* supported_origins,
                           const ErrorLogger& log) {}

void ParseIcons(const base::Value::Dict& dict,
                const ErrorLogger& log,
                std::vector<PaymentManifestParser::WebAppIcon>* icons) {}

void ParsePreferredRelatedApplicationIdentifiers(
    const base::Value::Dict& dict,
    const ErrorLogger& log,
    std::vector<std::string>* ids) {}

bool GetString(const base::Value::Dict* dict,
               std::string_view key,
               std::string& result) {}

}  // namespace

PaymentManifestParser::WebAppIcon::WebAppIcon() = default;

PaymentManifestParser::WebAppIcon::~WebAppIcon() = default;

PaymentManifestParser::PaymentManifestParser(std::unique_ptr<ErrorLogger> log)
    :{}

PaymentManifestParser::~PaymentManifestParser() = default;

void PaymentManifestParser::ParsePaymentMethodManifest(
    const GURL& manifest_url,
    const std::string& content,
    PaymentMethodCallback callback) {}

void PaymentManifestParser::ParseWebAppManifest(const std::string& content,
                                                WebAppCallback callback) {}

void PaymentManifestParser::ParseWebAppInstallationInfo(
    const std::string& content,
    WebAppInstallationInfoCallback callback) {}

// static
void PaymentManifestParser::ParsePaymentMethodManifestIntoVectors(
    const GURL& manifest_url,
    base::Value value,
    const ErrorLogger& log,
    std::vector<GURL>* web_app_manifest_urls,
    std::vector<url::Origin>* supported_origins) {}

// static
bool PaymentManifestParser::ParseWebAppManifestIntoVector(
    base::Value value,
    const ErrorLogger& log,
    std::vector<WebAppManifestSection>* output) {}

// static
bool PaymentManifestParser::ParseWebAppInstallationInfoIntoStructs(
    base::Value value,
    const ErrorLogger& log,
    WebAppInstallationInfo* installation_info,
    std::vector<WebAppIcon>* icons) {}

void PaymentManifestParser::OnPaymentMethodParse(
    const GURL& manifest_url,
    PaymentMethodCallback callback,
    data_decoder::DataDecoder::ValueOrError result) {}

void PaymentManifestParser::OnWebAppParse(
    WebAppCallback callback,
    data_decoder::DataDecoder::ValueOrError result) {}

void PaymentManifestParser::OnWebAppParseInstallationInfo(
    WebAppInstallationInfoCallback callback,
    data_decoder::DataDecoder::ValueOrError result) {}

}  // namespace payments