Index: components/payments/content/payment_manifest_section_table.h |
diff --git a/components/payments/content/payment_manifest_section_table.h b/components/payments/content/payment_manifest_section_table.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8b37a9dd7c4756c5d6d250eae6af5343bd00a9a4 |
--- /dev/null |
+++ b/components/payments/content/payment_manifest_section_table.h |
@@ -0,0 +1,62 @@ |
+// 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_PAYMENT_MANIFEST_SECTION_CACHE_H_ |
+#define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_MANIFEST_SECTION_CACHE_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "components/payments/content/payment_manifest_parser.mojom.h" |
+#include "components/webdata/common/web_database.h" |
+#include "components/webdata/common/web_database_table.h" |
+ |
+namespace payments { |
+ |
+// This class manages payment_request_section table in SQLite database. It |
+// expects the following schema. |
+// The interfaces should only be accessed on DB thread. |
+// |
+// payment_request_section The table stores the contents in |
+// PaymentManifestSection. |
+// |
+// method_name Payment method name of the section. |
+// package_name Package name of the payment app in the section. |
+// version Minimum version of the payment app in the |
+// section. |
+// finger_prints Finger prints in the section which is |
+// calculated with SHA-256. |
+// |
+class PaymentManifestSectionTable : public WebDatabaseTable { |
+ public: |
+ PaymentManifestSectionTable(); |
+ ~PaymentManifestSectionTable() override; |
+ |
+ // Retrieves the PaymentManifestSectionTable* owned by |db|. |
+ static PaymentManifestSectionTable* FromWebDatabase(WebDatabase* db); |
+ |
+ // WebDatabaseTable: |
+ WebDatabaseTable::TypeKey GetTypeKey() const override; |
+ bool CreateTablesIfNecessary() override; |
+ bool IsSyncable() override; |
+ bool MigrateToVersion(int version, bool* update_compatible_version) override; |
+ |
+ // Adds |manifest| of the |method_name|. Note that the previous manifest will |
+ // be deleted. |
+ bool AddPaymentManifestSections( |
+ const std::string& method_name, |
+ const std::vector<mojom::PaymentManifestSectionPtr>& manifest); |
+ |
+ // Gets manifest of the |method_name|. Returns empty vector if no manifest |
+ // exists for the |method_name|. |
+ std::vector<mojom::PaymentManifestSectionPtr> GetPaymentManifestSections( |
+ const std::string& method_name); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(PaymentManifestSectionTable); |
+}; |
+ |
+} // namespace payments |
+ |
+#endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_MANIFEST_SECTION_CACHE_H_ |