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

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

Issue 2665583002: PaymentApp: Rename PaymentAppRequestData to PaymentAppRequest. (Closed)
Patch Set: android Created 3 years, 10 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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_provider_impl.h" 5 #include "content/browser/payments/payment_app_provider_impl.h"
6 6
7 #include "content/browser/payments/payment_app_context_impl.h" 7 #include "content/browser/payments/payment_app_context_impl.h"
8 #include "content/browser/service_worker/service_worker_context_wrapper.h" 8 #include "content/browser/service_worker/service_worker_context_wrapper.h"
9 #include "content/browser/service_worker/service_worker_metrics.h" 9 #include "content/browser/service_worker/service_worker_metrics.h"
10 #include "content/browser/service_worker/service_worker_version.h" 10 #include "content/browser/service_worker/service_worker_version.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 service_worker_status == SERVICE_WORKER_OK, 42 service_worker_status == SERVICE_WORKER_OK,
43 dispatch_event_time); 43 dispatch_event_time);
44 } 44 }
45 45
46 void DispatchPaymentRequestEventError( 46 void DispatchPaymentRequestEventError(
47 ServiceWorkerStatusCode service_worker_status) { 47 ServiceWorkerStatusCode service_worker_status) {
48 NOTIMPLEMENTED(); 48 NOTIMPLEMENTED();
49 } 49 }
50 50
51 void DispatchPaymentRequestEvent( 51 void DispatchPaymentRequestEvent(
52 payments::mojom::PaymentAppRequestDataPtr data, 52 payments::mojom::PaymentAppRequestPtr appRequest,
jam 2017/01/30 18:05:00 app_request per style guide
53 scoped_refptr<ServiceWorkerVersion> active_version) { 53 scoped_refptr<ServiceWorkerVersion> active_version) {
54 DCHECK_CURRENTLY_ON(BrowserThread::IO); 54 DCHECK_CURRENTLY_ON(BrowserThread::IO);
55 DCHECK(active_version); 55 DCHECK(active_version);
56 56
57 int request_id = active_version->StartRequest( 57 int request_id = active_version->StartRequest(
58 ServiceWorkerMetrics::EventType::PAYMENT_REQUEST, 58 ServiceWorkerMetrics::EventType::PAYMENT_REQUEST,
59 base::Bind(&DispatchPaymentRequestEventError)); 59 base::Bind(&DispatchPaymentRequestEventError));
60 60
61 active_version->event_dispatcher()->DispatchPaymentRequestEvent( 61 active_version->event_dispatcher()->DispatchPaymentRequestEvent(
62 std::move(data), 62 std::move(appRequest),
63 base::Bind(&DidDispatchPaymentRequestEvent, active_version, request_id)); 63 base::Bind(&DidDispatchPaymentRequestEvent, active_version, request_id));
64 } 64 }
65 65
66 void DidFindRegistrationOnIO( 66 void DidFindRegistrationOnIO(
67 payments::mojom::PaymentAppRequestDataPtr data, 67 payments::mojom::PaymentAppRequestPtr appRequest,
68 ServiceWorkerStatusCode service_worker_status, 68 ServiceWorkerStatusCode service_worker_status,
69 scoped_refptr<ServiceWorkerRegistration> service_worker_registration) { 69 scoped_refptr<ServiceWorkerRegistration> service_worker_registration) {
70 DCHECK_CURRENTLY_ON(BrowserThread::IO); 70 DCHECK_CURRENTLY_ON(BrowserThread::IO);
71 71
72 if (service_worker_status != SERVICE_WORKER_OK) 72 if (service_worker_status != SERVICE_WORKER_OK)
73 return; 73 return;
74 74
75 ServiceWorkerVersion* active_version = 75 ServiceWorkerVersion* active_version =
76 service_worker_registration->active_version(); 76 service_worker_registration->active_version();
77 DCHECK(active_version); 77 DCHECK(active_version);
78 active_version->RunAfterStartWorker( 78 active_version->RunAfterStartWorker(
79 ServiceWorkerMetrics::EventType::PAYMENT_REQUEST, 79 ServiceWorkerMetrics::EventType::PAYMENT_REQUEST,
80 base::Bind(&DispatchPaymentRequestEvent, base::Passed(std::move(data)), 80 base::Bind(&DispatchPaymentRequestEvent,
81 base::Passed(std::move(appRequest)),
81 make_scoped_refptr(active_version)), 82 make_scoped_refptr(active_version)),
82 base::Bind(&DispatchPaymentRequestEventError)); 83 base::Bind(&DispatchPaymentRequestEventError));
83 } 84 }
84 85
85 void FindRegistrationOnIO( 86 void FindRegistrationOnIO(
86 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, 87 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
87 int64_t registration_id, 88 int64_t registration_id,
88 payments::mojom::PaymentAppRequestDataPtr data) { 89 payments::mojom::PaymentAppRequestPtr appRequest) {
89 DCHECK_CURRENTLY_ON(BrowserThread::IO); 90 DCHECK_CURRENTLY_ON(BrowserThread::IO);
90 91
91 service_worker_context->FindReadyRegistrationForIdOnly( 92 service_worker_context->FindReadyRegistrationForIdOnly(
92 registration_id, 93 registration_id, base::Bind(&DidFindRegistrationOnIO,
93 base::Bind(&DidFindRegistrationOnIO, base::Passed(std::move(data)))); 94 base::Passed(std::move(appRequest))));
94 } 95 }
95 96
96 } // namespace 97 } // namespace
97 98
98 // static 99 // static
99 PaymentAppProvider* PaymentAppProvider::GetInstance() { 100 PaymentAppProvider* PaymentAppProvider::GetInstance() {
100 return PaymentAppProviderImpl::GetInstance(); 101 return PaymentAppProviderImpl::GetInstance();
101 } 102 }
102 103
103 // static 104 // static
(...skipping 13 matching lines...) Expand all
117 partition->GetPaymentAppContext(); 118 partition->GetPaymentAppContext();
118 119
119 BrowserThread::PostTask( 120 BrowserThread::PostTask(
120 BrowserThread::IO, FROM_HERE, 121 BrowserThread::IO, FROM_HERE,
121 base::Bind(&GetAllManifestsOnIO, payment_app_context, callback)); 122 base::Bind(&GetAllManifestsOnIO, payment_app_context, callback));
122 } 123 }
123 124
124 void PaymentAppProviderImpl::InvokePaymentApp( 125 void PaymentAppProviderImpl::InvokePaymentApp(
125 BrowserContext* browser_context, 126 BrowserContext* browser_context,
126 int64_t registration_id, 127 int64_t registration_id,
127 payments::mojom::PaymentAppRequestDataPtr data) { 128 payments::mojom::PaymentAppRequestPtr appRequest) {
128 DCHECK_CURRENTLY_ON(BrowserThread::UI); 129 DCHECK_CURRENTLY_ON(BrowserThread::UI);
129 130
130 StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>( 131 StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
131 BrowserContext::GetDefaultStoragePartition(browser_context)); 132 BrowserContext::GetDefaultStoragePartition(browser_context));
132 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = 133 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context =
133 partition->GetServiceWorkerContext(); 134 partition->GetServiceWorkerContext();
134 135
135 BrowserThread::PostTask( 136 BrowserThread::PostTask(
136 BrowserThread::IO, FROM_HERE, 137 BrowserThread::IO, FROM_HERE,
137 base::Bind(&FindRegistrationOnIO, std::move(service_worker_context), 138 base::Bind(&FindRegistrationOnIO, std::move(service_worker_context),
138 registration_id, base::Passed(std::move(data)))); 139 registration_id, base::Passed(std::move(appRequest))));
139 } 140 }
140 141
141 PaymentAppProviderImpl::PaymentAppProviderImpl() {} 142 PaymentAppProviderImpl::PaymentAppProviderImpl() {}
142 143
143 PaymentAppProviderImpl::~PaymentAppProviderImpl() {} 144 PaymentAppProviderImpl::~PaymentAppProviderImpl() {}
144 145
145 } // namespace content 146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698