Chromium Code Reviews| 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..7513587de91c881c3120792915aa4dc897880c45 |
| --- /dev/null |
| +++ b/content/browser/payments/payment_app_provider_impl.cc |
| @@ -0,0 +1,63 @@ |
| +// 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(); |
| +} |
| + |
|
please use gerrit instead
2017/01/04 16:55:43
Also needs "// static" comment.
zino
2017/01/04 17:29:59
Done.
|
| +PaymentAppProviderImpl* PaymentAppProviderImpl::GetInstance() { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + return base::Singleton<PaymentAppProviderImpl>::get(); |
| +} |
| + |
| +PaymentAppProviderImpl::PaymentAppProviderImpl() {} |
| + |
| +PaymentAppProviderImpl::~PaymentAppProviderImpl() {} |
| + |
| +void PaymentAppProviderImpl::GetAllManifests( |
|
please use gerrit instead
2017/01/04 16:55:43
Please keep all methods in .cc in the same order a
zino
2017/01/04 17:29:59
Done.
|
| + 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)); |
| +} |
| + |
| +} // namespace content |