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

Side by Side 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: address comments 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 unified diff | Download patch
OLDNEW
(Empty)
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
5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_MANIFEST_SECTION_CACHE_H_
6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_MANIFEST_SECTION_CACHE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "components/payments/content/payment_manifest_parser.mojom.h"
12 #include "components/webdata/common/web_database.h"
13 #include "components/webdata/common/web_database_table.h"
14
15 namespace payments {
16
17 // This class manages payment_request_section table in SQLite database. It
18 // expects the following schema.
19 // The interfaces should only be accessed on DB thread.
please use gerrit instead 2017/04/06 14:35:29 Please put a DCHECK for the DB thread in AddPaymen
gogerald1 2017/04/06 16:42:09 Done.
20 //
21 // payment_request_section The table stores the contents in
22 // PaymentManifestSection.
23 //
24 // method_name Payment method name of the section.
25 // package_name Package name of the payment app in the section.
26 // version Minimum version of the payment app in the
27 // section.
28 // finger_prints Finger prints in the section which is
29 // calculated with SHA-256.
30 //
31 class PaymentManifestSectionTable : public WebDatabaseTable {
32 public:
33 PaymentManifestSectionTable();
34 ~PaymentManifestSectionTable() override;
35
36 // Retrieves the PaymentManifestSectionTable* owned by |db|.
37 static PaymentManifestSectionTable* FromWebDatabase(WebDatabase* db);
38
39 // WebDatabaseTable:
40 WebDatabaseTable::TypeKey GetTypeKey() const override;
41 bool CreateTablesIfNecessary() override;
42 bool IsSyncable() override;
43 bool MigrateToVersion(int version, bool* update_compatible_version) override;
44
45 // Adds |manifest| of the |method_name|. Note that the previous manifest will
46 // be deleted.
47 bool AddPaymentManifestSections(
48 const std::string& method_name,
49 const std::vector<mojom::PaymentManifestSectionPtr>& manifest);
50
51 // Gets manifest of the |method_name|. Returns empty vector if no manifest
52 // exists for the |method_name|.
53 std::vector<mojom::PaymentManifestSectionPtr> GetPaymentManifestSections(
54 const std::string& method_name);
55
56 private:
57 DISALLOW_COPY_AND_ASSIGN(PaymentManifestSectionTable);
58 };
59
60 } // namespace payments
61
62 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_MANIFEST_SECTION_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698