blob: 494f305c058c9e4bfcd79a400c1c126b1a8433a8 [file] [log] [blame]
rouslan8fdbfb242017-03-15 01:12:491// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
rouslanbb7522e2017-03-28 17:06:195#ifndef COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_
6#define COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_
rouslan8fdbfb242017-03-15 01:12:497
8#include <string>
9#include <vector>
10
11#include "base/macros.h"
rouslanbb7522e2017-03-28 17:06:1912#include "components/payments/content/payment_manifest_parser.mojom.h"
rouslan8fdbfb242017-03-15 01:12:4913
14namespace payments {
15
16// Parser for payment manifests. Should be used only in a utility process.
17//
18// Example valid manifest structure:
19//
20// {
21// "android": [{
22// "package": "com.bobpay.app",
23// "version": 1,
24// "sha256_cert_fingerprints": ["12:34:56:78:90:AB:CD:EF"]
25// }]
26// }
27//
28// Spec:
29// https://docs.google.com/document/d/1izV4uC-tiRJG3JLooqY3YRLU22tYOsLTNq0P_InPJeE/edit#heading=h.cjp3jlnl47h5
30class PaymentManifestParser : public mojom::PaymentManifestParser {
31 public:
32 static void Create(mojom::PaymentManifestParserRequest request);
33
34 // The return value is move-only, so no copying occurs.
35 static std::vector<mojom::PaymentManifestSectionPtr> ParseIntoVector(
36 const std::string& input);
37
38 PaymentManifestParser();
39 ~PaymentManifestParser() override;
40
41 // mojom::PaymentManifestParser
42 void Parse(const std::string& content,
43 const ParseCallback& callback) override;
44
45 private:
46 DISALLOW_COPY_AND_ASSIGN(PaymentManifestParser);
47};
48
49} // namespace payments
50
rouslanbb7522e2017-03-28 17:06:1951#endif // COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_