rouslan | 8fdbfb24 | 2017-03-15 01:12:49 | [diff] [blame] | 1 | // 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 | |
rouslan | bb7522e | 2017-03-28 17:06:19 | [diff] [blame^] | 5 | #ifndef COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_ |
| 6 | #define COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_ |
rouslan | 8fdbfb24 | 2017-03-15 01:12:49 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | #include "base/macros.h" |
rouslan | bb7522e | 2017-03-28 17:06:19 | [diff] [blame^] | 12 | #include "components/payments/content/payment_manifest_parser.mojom.h" |
rouslan | 8fdbfb24 | 2017-03-15 01:12:49 | [diff] [blame] | 13 | |
| 14 | namespace 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 |
| 30 | class 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 | |
rouslan | bb7522e | 2017-03-28 17:06:19 | [diff] [blame^] | 51 | #endif // COMPONENTS_PAYMENTS_CONTENT_UTILITY_PAYMENT_MANIFEST_PARSER_H_ |