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