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

Side by Side Diff: content/browser/payments/payment_app_provider_impl.cc

Issue 2609103002: PaymentApp: Add PaymentAppProvider class. (Closed)
Patch Set: PaymentApp: Add PaymentAppProvider class. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/payments/payment_app_provider_impl.h"
6
7 #include "content/browser/payments/payment_app_context_impl.h"
8 #include "content/browser/storage_partition_impl.h"
9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/browser_thread.h"
11
12 namespace content {
13 namespace {
14
15 void DidGetAllManifestsOnIO(
16 const PaymentAppProvider::GetAllManifestsCallback& callback,
17 PaymentAppProvider::Manifests manifests) {
18 BrowserThread::PostTask(
19 BrowserThread::UI, FROM_HERE,
20 base::Bind(callback, base::Passed(std::move(manifests))));
21 }
22
23 void GetAllManifestsOnIO(
24 const scoped_refptr<PaymentAppContextImpl>& payment_app_context,
25 const PaymentAppProvider::GetAllManifestsCallback& callback) {
26 DCHECK_CURRENTLY_ON(BrowserThread::IO);
27
28 payment_app_context->payment_app_database()->ReadAllManifests(
29 base::Bind(&DidGetAllManifestsOnIO, callback));
30 }
31
32 } // namespace
33
34 // static
35 PaymentAppProvider* PaymentAppProvider::GetInstance() {
36 return PaymentAppProviderImpl::GetInstance();
37 }
38
please use gerrit instead 2017/01/04 16:55:43 Also needs "// static" comment.
zino 2017/01/04 17:29:59 Done.
39 PaymentAppProviderImpl* PaymentAppProviderImpl::GetInstance() {
40 DCHECK_CURRENTLY_ON(BrowserThread::UI);
41 return base::Singleton<PaymentAppProviderImpl>::get();
42 }
43
44 PaymentAppProviderImpl::PaymentAppProviderImpl() {}
45
46 PaymentAppProviderImpl::~PaymentAppProviderImpl() {}
47
48 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.
49 BrowserContext* browser_context,
50 const GetAllManifestsCallback& callback) {
51 DCHECK_CURRENTLY_ON(BrowserThread::UI);
52
53 StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
54 BrowserContext::GetDefaultStoragePartition(browser_context));
55 scoped_refptr<PaymentAppContextImpl> payment_app_context =
56 partition->GetPaymentAppContext();
57
58 BrowserThread::PostTask(
59 BrowserThread::IO, FROM_HERE,
60 base::Bind(&GetAllManifestsOnIO, payment_app_context, callback));
61 }
62
63 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698