Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: components/payments/content/payment_manifest_section_table.h

Issue 2801513002: [Payments] Add web app manifest section table in SQLite web database (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..fd581d00e46624a69c5b198063cc1830ed07e942
--- /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 "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.
please use gerrit instead 2017/04/05 20:33:31 On what thread does this object live?
gogerald1 2017/04/05 23:38:49 Done.
+//
+// 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(
+ std::string& method_name,
+ std::vector<mojom::PaymentManifestSectionPtr>& manifest);
please use gerrit instead 2017/04/05 20:33:31 both parameters should be const.
gogerald1 2017/04/05 23:38:49 Done.
+
+ // Gets manifest of the |method_name|. Returns empty vector if no manifest
+ // exists for the |method_name|.
+ std::vector<mojom::PaymentManifestSectionPtr> GetPaymentManifestSections(
+ std::string& method_name);
please use gerrit instead 2017/04/05 20:33:31 const parameter.
gogerald1 2017/04/05 23:38:49 Done.
+
+ private:
+ std::unique_ptr<std::vector<uint8_t>> SerializeFingerPrints(
please use gerrit instead 2017/04/05 20:33:31 1) Move these two functions into anonymous namespa
gogerald1 2017/04/05 23:38:49 Done.
+ const std::vector<std::vector<uint8_t>>& finger_prints);
+
+ void DeserializeFingerPrints(
+ const std::vector<uint8_t>& finger_prints,
+ std::vector<std::vector<uint8_t>>& deserialized_finger_prints);
+};
please use gerrit instead 2017/04/05 20:33:31 Disallow copy and assign.
gogerald1 2017/04/05 23:38:49 Done.
+} // namespace payments
please use gerrit instead 2017/04/05 20:33:31 Add newline after };
gogerald1 2017/04/05 23:38:49 Done.
+
+#endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_MANIFEST_SECTION_CACHE_H_

Powered by Google App Engine
This is Rietveld 408576698