OLD | NEW |
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 #include "components/payments/android/payment_manifest_web_data_service.h" | 5 #include "components/payments/android/payment_manifest_web_data_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 | 9 |
10 namespace payments { | 10 namespace payments { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 FROM_HERE, | 65 FROM_HERE, |
66 base::Bind(&PaymentManifestWebDataService::GetPaymentWebAppManifestImpl, | 66 base::Bind(&PaymentManifestWebDataService::GetPaymentWebAppManifestImpl, |
67 this, web_app), | 67 this, web_app), |
68 consumer); | 68 consumer); |
69 } | 69 } |
70 | 70 |
71 std::unique_ptr<WDTypedResult> | 71 std::unique_ptr<WDTypedResult> |
72 PaymentManifestWebDataService::GetPaymentWebAppManifestImpl( | 72 PaymentManifestWebDataService::GetPaymentWebAppManifestImpl( |
73 const std::string& web_app, | 73 const std::string& web_app, |
74 WebDatabase* db) { | 74 WebDatabase* db) { |
| 75 RemoveExpiredData(db); |
75 return base::MakeUnique< | 76 return base::MakeUnique< |
76 WDResult<std::vector<mojom::WebAppManifestSectionPtr>>>( | 77 WDResult<std::vector<mojom::WebAppManifestSectionPtr>>>( |
77 PAYMENT_WEB_APP_MANIFEST, | 78 PAYMENT_WEB_APP_MANIFEST, |
78 WebAppManifestSectionTable::FromWebDatabase(db)->GetWebAppManifest( | 79 WebAppManifestSectionTable::FromWebDatabase(db)->GetWebAppManifest( |
79 web_app)); | 80 web_app)); |
80 } | 81 } |
81 | 82 |
82 WebDataServiceBase::Handle | 83 WebDataServiceBase::Handle |
83 PaymentManifestWebDataService::GetPaymentMethodManifest( | 84 PaymentManifestWebDataService::GetPaymentMethodManifest( |
84 const std::string& payment_method, | 85 const std::string& payment_method, |
85 WebDataServiceConsumer* consumer) { | 86 WebDataServiceConsumer* consumer) { |
86 return wdbs_->ScheduleDBTaskWithResult( | 87 return wdbs_->ScheduleDBTaskWithResult( |
87 FROM_HERE, | 88 FROM_HERE, |
88 base::Bind(&PaymentManifestWebDataService::GetPaymentMethodManifestImpl, | 89 base::Bind(&PaymentManifestWebDataService::GetPaymentMethodManifestImpl, |
89 this, payment_method), | 90 this, payment_method), |
90 consumer); | 91 consumer); |
91 } | 92 } |
92 | 93 |
93 std::unique_ptr<WDTypedResult> | 94 std::unique_ptr<WDTypedResult> |
94 PaymentManifestWebDataService::GetPaymentMethodManifestImpl( | 95 PaymentManifestWebDataService::GetPaymentMethodManifestImpl( |
95 const std::string& payment_method, | 96 const std::string& payment_method, |
96 WebDatabase* db) { | 97 WebDatabase* db) { |
| 98 RemoveExpiredData(db); |
97 return base::MakeUnique<WDResult<std::vector<std::string>>>( | 99 return base::MakeUnique<WDResult<std::vector<std::string>>>( |
98 PAYMENT_METHOD_MANIFEST, | 100 PAYMENT_METHOD_MANIFEST, |
99 PaymentMethodManifestTable::FromWebDatabase(db)->GetManifest( | 101 PaymentMethodManifestTable::FromWebDatabase(db)->GetManifest( |
100 payment_method)); | 102 payment_method)); |
101 } | 103 } |
102 | 104 |
| 105 void PaymentManifestWebDataService::RemoveExpiredData(WebDatabase* db) { |
| 106 PaymentMethodManifestTable::FromWebDatabase(db)->RemoveExpiredData(); |
| 107 WebAppManifestSectionTable::FromWebDatabase(db)->RemoveExpiredData(); |
| 108 } |
| 109 |
103 } // namespace payments | 110 } // namespace payments |
OLD | NEW |