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

Side by Side Diff: components/payments/content/payment_request.cc

Issue 2780773004: Reland "PaymentRequest: Introduce PaymentDetailsInit and PaymentDetailsUpdate." (Closed)
Patch Set: Reland "PaymentRequest: Introduce PaymentDetailsInit and PaymentDetailsUpdate." Created 3 years, 8 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 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 "components/payments/content/payment_request.h" 5 #include "components/payments/content/payment_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "components/payments/content/payment_details_validation.h" 10 #include "components/payments/content/payment_details_validation.h"
(...skipping 30 matching lines...) Expand all
41 std::vector<payments::mojom::PaymentMethodDataPtr> method_data, 41 std::vector<payments::mojom::PaymentMethodDataPtr> method_data,
42 payments::mojom::PaymentDetailsPtr details, 42 payments::mojom::PaymentDetailsPtr details,
43 payments::mojom::PaymentOptionsPtr options) { 43 payments::mojom::PaymentOptionsPtr options) {
44 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 44 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
45 std::string error; 45 std::string error;
46 if (!payments::validatePaymentDetails(details, &error)) { 46 if (!payments::validatePaymentDetails(details, &error)) {
47 LOG(ERROR) << error; 47 LOG(ERROR) << error;
48 OnConnectionTerminated(); 48 OnConnectionTerminated();
49 return; 49 return;
50 } 50 }
51 if (!details->total) {
52 LOG(ERROR) << "Missing total";
53 OnConnectionTerminated();
54 return;
55 }
51 client_ = std::move(client); 56 client_ = std::move(client);
52 spec_ = base::MakeUnique<PaymentRequestSpec>( 57 spec_ = base::MakeUnique<PaymentRequestSpec>(
53 std::move(options), std::move(details), std::move(method_data), this, 58 std::move(options), std::move(details), std::move(method_data), this,
54 delegate_->GetApplicationLocale()); 59 delegate_->GetApplicationLocale());
55 state_ = base::MakeUnique<PaymentRequestState>( 60 state_ = base::MakeUnique<PaymentRequestState>(
56 spec_.get(), this, delegate_->GetApplicationLocale(), 61 spec_.get(), this, delegate_->GetApplicationLocale(),
57 delegate_->GetPersonalDataManager()); 62 delegate_->GetPersonalDataManager());
58 } 63 }
59 64
60 void PaymentRequest::Show() { 65 void PaymentRequest::Show() {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 binding_.Close(); 135 binding_.Close();
131 delegate_->CloseDialog(); 136 delegate_->CloseDialog();
132 manager_->DestroyRequest(this); 137 manager_->DestroyRequest(this);
133 } 138 }
134 139
135 void PaymentRequest::Pay() { 140 void PaymentRequest::Pay() {
136 state_->GeneratePaymentResponse(); 141 state_->GeneratePaymentResponse();
137 } 142 }
138 143
139 } // namespace payments 144 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_details_validation.cc ('k') | components/payments/content/payment_request.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698