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

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

Issue 2556433002: PaymentApp: Implement GetAllManifests() in PaymentAppContext. (Closed)
Patch Set: addressed comments Created 4 years 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/payments/payment_app_context_impl.h" 5 #include "content/browser/payments/payment_app_context_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "content/browser/payments/payment_app_database.h"
13 #include "content/browser/payments/payment_app_manager.h" 12 #include "content/browser/payments/payment_app_manager.h"
14 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
15 14
16 namespace content { 15 namespace content {
17 16
18 PaymentAppContextImpl::PaymentAppContextImpl() : is_shutdown_(false) { 17 PaymentAppContextImpl::PaymentAppContextImpl() : is_shutdown_(false) {
19 DCHECK_CURRENTLY_ON(BrowserThread::UI); 18 DCHECK_CURRENTLY_ON(BrowserThread::UI);
20 } 19 }
21 20
22 void PaymentAppContextImpl::Init( 21 void PaymentAppContextImpl::Init(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 payment_app_managers_.erase(payment_app_manager); 56 payment_app_managers_.erase(payment_app_manager);
58 } 57 }
59 58
60 PaymentAppDatabase* PaymentAppContextImpl::payment_app_database() const { 59 PaymentAppDatabase* PaymentAppContextImpl::payment_app_database() const {
61 DCHECK_CURRENTLY_ON(BrowserThread::IO); 60 DCHECK_CURRENTLY_ON(BrowserThread::IO);
62 return payment_app_database_.get(); 61 return payment_app_database_.get();
63 } 62 }
64 63
65 void PaymentAppContextImpl::GetAllManifests( 64 void PaymentAppContextImpl::GetAllManifests(
66 const GetAllManifestsCallback& callback) { 65 const GetAllManifestsCallback& callback) {
67 NOTIMPLEMENTED(); 66 DCHECK_CURRENTLY_ON(BrowserThread::UI);
67 BrowserThread::PostTask(
68 BrowserThread::IO, FROM_HERE,
69 base::Bind(&PaymentAppContextImpl::GetAllManifestsOnIO, this, callback));
68 } 70 }
69 71
70 PaymentAppContextImpl::~PaymentAppContextImpl() { 72 PaymentAppContextImpl::~PaymentAppContextImpl() {
71 DCHECK_CURRENTLY_ON(BrowserThread::UI); 73 DCHECK_CURRENTLY_ON(BrowserThread::UI);
72 DCHECK(is_shutdown_); 74 DCHECK(is_shutdown_);
73 } 75 }
74 76
75 void PaymentAppContextImpl::CreatePaymentAppDatabaseOnIO( 77 void PaymentAppContextImpl::CreatePaymentAppDatabaseOnIO(
76 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) { 78 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) {
77 DCHECK_CURRENTLY_ON(BrowserThread::IO); 79 DCHECK_CURRENTLY_ON(BrowserThread::IO);
(...skipping 16 matching lines...) Expand all
94 payment_app_managers_.clear(); 96 payment_app_managers_.clear();
95 payment_app_database_.reset(); 97 payment_app_database_.reset();
96 } 98 }
97 99
98 void PaymentAppContextImpl::DidShutdown() { 100 void PaymentAppContextImpl::DidShutdown() {
99 DCHECK_CURRENTLY_ON(BrowserThread::UI); 101 DCHECK_CURRENTLY_ON(BrowserThread::UI);
100 102
101 is_shutdown_ = true; 103 is_shutdown_ = true;
102 } 104 }
103 105
106 void PaymentAppContextImpl::GetAllManifestsOnIO(
107 const GetAllManifestsCallback& callback) {
108 DCHECK_CURRENTLY_ON(BrowserThread::IO);
109 payment_app_database()->ReadAllManifests(base::Bind(
110 &PaymentAppContextImpl::DidGetAllManifestsOnIO, this, callback));
111 }
112
113 void PaymentAppContextImpl::DidGetAllManifestsOnIO(
114 const GetAllManifestsCallback& callback,
115 Manifests manifests) {
116 DCHECK_CURRENTLY_ON(BrowserThread::IO);
117
118 BrowserThread::PostTask(
119 BrowserThread::UI, FROM_HERE,
120 base::Bind(callback, base::Passed(std::move(manifests))));
121 }
122
104 } // namespace content 123 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/payments/payment_app_context_impl.h ('k') | content/browser/payments/payment_app_context_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698