| 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
|
|
|