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

Unified Diff: content/browser/payments/payment_app_provider_impl.cc

Issue 2609103002: PaymentApp: Add PaymentAppProvider class. (Closed)
Patch Set: Remove override keyword Created 3 years, 11 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
Index: content/browser/payments/payment_app_provider_impl.cc
diff --git a/content/browser/payments/payment_app_provider_impl.cc b/content/browser/payments/payment_app_provider_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0d88e87924f453dcbab518c9e667a13437863f02
--- /dev/null
+++ b/content/browser/payments/payment_app_provider_impl.cc
@@ -0,0 +1,64 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/payments/payment_app_provider_impl.h"
+
+#include "content/browser/payments/payment_app_context_impl.h"
+#include "content/browser/storage_partition_impl.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace content {
+namespace {
+
+void DidGetAllManifestsOnIO(
+ const PaymentAppProvider::GetAllManifestsCallback& callback,
+ PaymentAppProvider::Manifests manifests) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(callback, base::Passed(std::move(manifests))));
+}
+
+void GetAllManifestsOnIO(
+ const scoped_refptr<PaymentAppContextImpl>& payment_app_context,
+ const PaymentAppProvider::GetAllManifestsCallback& callback) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ payment_app_context->payment_app_database()->ReadAllManifests(
+ base::Bind(&DidGetAllManifestsOnIO, callback));
+}
+
+} // namespace
+
+// static
+PaymentAppProvider* PaymentAppProvider::GetInstance() {
+ return PaymentAppProviderImpl::GetInstance();
+}
+
+// static
+PaymentAppProviderImpl* PaymentAppProviderImpl::GetInstance() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ return base::Singleton<PaymentAppProviderImpl>::get();
+}
+
+void PaymentAppProviderImpl::GetAllManifests(
+ BrowserContext* browser_context,
+ const GetAllManifestsCallback& callback) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
+ BrowserContext::GetDefaultStoragePartition(browser_context));
+ scoped_refptr<PaymentAppContextImpl> payment_app_context =
+ partition->GetPaymentAppContext();
+
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&GetAllManifestsOnIO, payment_app_context, callback));
+}
+
+PaymentAppProviderImpl::PaymentAppProviderImpl() {}
+
+PaymentAppProviderImpl::~PaymentAppProviderImpl() {}
+
+} // namespace content
« no previous file with comments | « content/browser/payments/payment_app_provider_impl.h ('k') | content/browser/payments/payment_app_provider_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698