blob: 3e74394ed0c338a33aec5d299fd2ff82affacffb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_
#define COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_
#include <string>
#include <vector>
#include "base/macros.h"
#include "components/payments/content/payment_manifest_parser.mojom.h"
#include "url/gurl.h"
namespace payments {
// Parser for payment method manifests and web app manifests. Should be used
// only in a sandboxed utility process.
//
// Example valid payment method manifest structure:
//
// {
// "default_applications": ["https://bobpay.com/payment-app.json"],
// "supported_origins": ["https://alicepay.com"] // Not yet parsed or used.
// }
//
// Example valid web app manifest structure:
//
// {
// "related_applications": [{
// "platform": "play",
// "id": "com.bobpay.app",
// "min_version": "1",
// "fingerprint": [{
// "type": "sha256_cert",
// "value": "91:5C:88:65:FF:C4:E8:20:CF:F7:3E:C8:64:D0:95:F0:06:19:2E:A6"
// }]
// }]
// }
//
// Spec:
// https://docs.google.com/document/d/1izV4uC-tiRJG3JLooqY3YRLU22tYOsLTNq0P_InPJeE
class PaymentManifestParser : public mojom::PaymentManifestParser {
public:
static void Create(mojom::PaymentManifestParserRequest request);
static std::vector<GURL> ParsePaymentMethodManifestIntoVector(
const std::string& input);
// The return value is move-only, so no copying occurs.
static std::vector<mojom::WebAppManifestSectionPtr>
ParseWebAppManifestIntoVector(const std::string& input);
PaymentManifestParser();
~PaymentManifestParser() override;
// mojom::PaymentManifestParser
void ParsePaymentMethodManifest(
const std::string& content,
const ParsePaymentMethodManifestCallback& callback) override;
void ParseWebAppManifest(const std::string& content,
const ParseWebAppManifestCallback& callack) override;
private:
DISALLOW_COPY_AND_ASSIGN(PaymentManifestParser);
};
} // namespace payments
#endif // COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_
|