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

Unified Diff: content/browser/service_worker/service_worker_storage.cc

Issue 2873683002: PaymentHandler: Implement GetAllPaymentApps(). (Closed)
Patch Set: installed -> stored in public 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_storage.h ('k') | content/public/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_storage.cc
diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc
index d87ff7fa3012ec62afa5a5dee9014a6db49036cc..7525da2236e4fb29d8c0ea83a32dd2bfb71d7dc9 100644
--- a/content/browser/service_worker/service_worker_storage.cc
+++ b/content/browser/service_worker/service_worker_storage.cc
@@ -800,6 +800,39 @@ void ServiceWorkerStorage::GetUserDataForAllRegistrations(
callback)));
}
+void ServiceWorkerStorage::GetUserDataForAllRegistrationsByKeyPrefix(
+ const std::string& key_prefix,
+ const ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback&
+ callback) {
+ if (!LazyInitialize(base::Bind(
+ &ServiceWorkerStorage::GetUserDataForAllRegistrationsByKeyPrefix,
+ weak_factory_.GetWeakPtr(), key_prefix, callback))) {
+ if (state_ != INITIALIZING) {
+ RunSoon(
+ FROM_HERE,
+ base::Bind(callback, std::vector<std::pair<int64_t, std::string>>(),
+ SERVICE_WORKER_ERROR_ABORT));
+ }
+ return;
+ }
+ DCHECK_EQ(INITIALIZED, state_);
+
+ if (key_prefix.empty()) {
+ RunSoon(FROM_HERE,
+ base::Bind(callback, std::vector<std::pair<int64_t, std::string>>(),
+ SERVICE_WORKER_ERROR_FAILED));
+ return;
+ }
+
+ database_task_manager_->GetTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &ServiceWorkerStorage::GetUserDataForAllRegistrationsByKeyPrefixInDB,
+ database_.get(), base::ThreadTaskRunnerHandle::Get(), key_prefix,
+ base::Bind(&ServiceWorkerStorage::DidGetUserDataForAllRegistrations,
+ weak_factory_.GetWeakPtr(), callback)));
+}
+
bool ServiceWorkerStorage::OriginHasForeignFetchRegistrations(
const GURL& origin) {
return !IsDisabled() &&
@@ -1831,6 +1864,19 @@ void ServiceWorkerStorage::GetUserDataForAllRegistrationsInDB(
base::Bind(callback, user_data, status));
}
+void ServiceWorkerStorage::GetUserDataForAllRegistrationsByKeyPrefixInDB(
+ ServiceWorkerDatabase* database,
+ scoped_refptr<base::SequencedTaskRunner> original_task_runner,
+ const std::string& key_prefix,
+ const GetUserDataForAllRegistrationsInDBCallback& callback) {
+ std::vector<std::pair<int64_t, std::string>> user_data;
+ ServiceWorkerDatabase::Status status =
+ database->ReadUserDataForAllRegistrationsByKeyPrefix(key_prefix,
+ &user_data);
+ original_task_runner->PostTask(FROM_HERE,
+ base::Bind(callback, user_data, status));
+}
+
void ServiceWorkerStorage::DeleteAllDataForOriginsFromDB(
ServiceWorkerDatabase* database,
const std::set<GURL>& origins) {
« no previous file with comments | « content/browser/service_worker/service_worker_storage.h ('k') | content/public/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698