Index: content/browser/payments/payment_app_database.cc |
diff --git a/content/browser/payments/payment_app_database.cc b/content/browser/payments/payment_app_database.cc |
index 9f18a2dc242e44427a398d3af2cb6f1bdbb3122e..db0cf1cfbe33237f50d00a1c52a28c6dde56c5d8 100644 |
--- a/content/browser/payments/payment_app_database.cc |
+++ b/content/browser/payments/payment_app_database.cc |
@@ -104,6 +104,16 @@ void PaymentAppDatabase::ReadManifest(const GURL& scope, |
weak_ptr_factory_.GetWeakPtr(), callback)); |
} |
+void PaymentAppDatabase::ReadAllManifests( |
+ const ReadAllManifestsCallback& callback) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ |
+ service_worker_context_->GetUserDataForAllRegistrations( |
+ kPaymentAppManifestDataKey, |
+ base::Bind(&PaymentAppDatabase::DidReadAllManifests, |
+ weak_ptr_factory_.GetWeakPtr(), callback)); |
+} |
+ |
void PaymentAppDatabase::DidFindRegistrationToWriteManifest( |
payments::mojom::PaymentAppManifestPtr manifest, |
const WriteManifestCallback& callback, |
@@ -175,4 +185,28 @@ void PaymentAppDatabase::DidReadManifest(const ReadManifestCallback& callback, |
payments::mojom::PaymentAppManifestError::NONE); |
} |
+void PaymentAppDatabase::DidReadAllManifests( |
+ const ReadAllManifestsCallback& callback, |
+ const std::vector<std::pair<int64_t, std::string>>& raw_data, |
+ ServiceWorkerStatusCode status) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ if (status != SERVICE_WORKER_OK) { |
+ callback.Run(Manifests()); |
+ return; |
+ } |
+ |
+ Manifests manifests; |
+ for (auto& item_of_raw_data : raw_data) { |
+ payments::mojom::PaymentAppManifestPtr manifest = |
+ DeserializePaymentAppManifest(item_of_raw_data.second); |
+ if (!manifest) { |
+ continue; |
+ } |
+ manifests.push_back( |
+ ManifestWithID(item_of_raw_data.first, std::move(manifest))); |
+ } |
+ |
+ callback.Run(std::move(manifests)); |
+} |
+ |
} // namespace content |