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

Side by Side Diff: components/payments/android/web_app_manifest_section_table.h

Issue 2845753003: [Payments] Set cached manifest expiration date (Closed)
Patch Set: improve comments Created 3 years, 7 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
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_ANDROID_WEB_APP_MANIFEST_SECTION_TABLE_H_ 5 #ifndef COMPONENTS_PAYMENTS_ANDROID_WEB_APP_MANIFEST_SECTION_TABLE_H_
6 #define COMPONENTS_PAYMENTS_ANDROID_WEB_APP_MANIFEST_SECTION_TABLE_H_ 6 #define COMPONENTS_PAYMENTS_ANDROID_WEB_APP_MANIFEST_SECTION_TABLE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "components/payments/mojom/payment_manifest_parser.mojom.h" 11 #include "components/payments/mojom/payment_manifest_parser.mojom.h"
12 #include "components/webdata/common/web_database.h" 12 #include "components/webdata/common/web_database.h"
13 #include "components/webdata/common/web_database_table.h" 13 #include "components/webdata/common/web_database_table.h"
14 14
15 namespace payments { 15 namespace payments {
16 16
17 // This class manages web_app_manifest_section table in SQLite database. It 17 // This class manages web_app_manifest_section table in SQLite database. It
18 // expects the following schema. 18 // expects the following schema.
19 // The interfaces should only be accessed on DB thread. 19 // The interfaces should only be accessed on DB thread.
20 // 20 //
21 // web_app_manifest_section The table stores the contents in 21 // web_app_manifest_section The table stores the contents in
22 // WebAppManifestSection. 22 // WebAppManifestSection.
23 // 23 //
24 // expire_date The data expire date in seconds from 1601-01-01
25 // 00:00:00 UTC.
24 // id The package name of the app. 26 // id The package name of the app.
25 // min_version Minimum version number of the app. 27 // min_version Minimum version number of the app.
26 // fingerprints The result of SHA256(signing certificate bytes) for 28 // fingerprints The result of SHA256(signing certificate bytes) for
27 // each certificate in the app. 29 // each certificate in the app.
28 // 30 //
29 class WebAppManifestSectionTable : public WebDatabaseTable { 31 class WebAppManifestSectionTable : public WebDatabaseTable {
30 public: 32 public:
31 WebAppManifestSectionTable(); 33 WebAppManifestSectionTable();
32 ~WebAppManifestSectionTable() override; 34 ~WebAppManifestSectionTable() override;
33 35
34 // Retrieves the WebAppManifestSectionTable* owned by |db|. 36 // Retrieves the WebAppManifestSectionTable* owned by |db|.
35 static WebAppManifestSectionTable* FromWebDatabase(WebDatabase* db); 37 static WebAppManifestSectionTable* FromWebDatabase(WebDatabase* db);
36 38
37 // WebDatabaseTable: 39 // WebDatabaseTable:
38 WebDatabaseTable::TypeKey GetTypeKey() const override; 40 WebDatabaseTable::TypeKey GetTypeKey() const override;
39 bool CreateTablesIfNecessary() override; 41 bool CreateTablesIfNecessary() override;
40 bool IsSyncable() override; 42 bool IsSyncable() override;
41 bool MigrateToVersion(int version, bool* update_compatible_version) override; 43 bool MigrateToVersion(int version, bool* update_compatible_version) override;
42 44
45 // Remove expired data.
46 void RemoveExpiredData();
47
43 // Adds the web app |manifest|. Note that the previous web app manifest will 48 // Adds the web app |manifest|. Note that the previous web app manifest will
44 // be deleted. 49 // be deleted.
45 bool AddWebAppManifest( 50 bool AddWebAppManifest(
46 const std::vector<mojom::WebAppManifestSectionPtr>& manifest); 51 const std::vector<mojom::WebAppManifestSectionPtr>& manifest);
47 52
48 // Gets manifest of the |web_app|. Returns empty vector if no manifest exists 53 // Gets manifest of the |web_app|. Returns empty vector if no manifest exists
49 // for the |web_app|. 54 // for the |web_app|.
50 std::vector<mojom::WebAppManifestSectionPtr> GetWebAppManifest( 55 std::vector<mojom::WebAppManifestSectionPtr> GetWebAppManifest(
51 const std::string& web_app); 56 const std::string& web_app);
52 57
53 private: 58 private:
54 DISALLOW_COPY_AND_ASSIGN(WebAppManifestSectionTable); 59 DISALLOW_COPY_AND_ASSIGN(WebAppManifestSectionTable);
55 }; 60 };
56 61
57 } // namespace payments 62 } // namespace payments
58 63
59 #endif // COMPONENTS_PAYMENTS_ANDROID_WEB_APP_MANIFEST_SECTION_TABLE_H_ 64 #endif // COMPONENTS_PAYMENTS_ANDROID_WEB_APP_MANIFEST_SECTION_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698