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

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

Powered by Google App Engine
This is Rietveld 408576698