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

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

Issue 2649143003: PaymentRequest: The currencySystem should be non-nullable. (Closed)
Patch Set: PaymentRequest: The currencySystem should be non-nullable. 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
« no previous file with comments | « components/payments/payment_request.h ('k') | components/payments/payment_request.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/payment_request.h" 5 #include "components/payments/payment_request.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "components/autofill/core/browser/personal_data_manager.h" 8 #include "components/autofill/core/browser/personal_data_manager.h"
9 #include "components/payments/payment_details_validation.h" 9 #include "components/payments/payment_details_validation.h"
10 #include "components/payments/payment_request_delegate.h" 10 #include "components/payments/payment_request_delegate.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); 58 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL);
59 } 59 }
60 60
61 void PaymentRequest::OnError() { 61 void PaymentRequest::OnError() {
62 binding_.Close(); 62 binding_.Close();
63 manager_->DestroyRequest(this); 63 manager_->DestroyRequest(this);
64 } 64 }
65 65
66 CurrencyFormatter* PaymentRequest::GetOrCreateCurrencyFormatter( 66 CurrencyFormatter* PaymentRequest::GetOrCreateCurrencyFormatter(
67 const std::string& currency_code, 67 const std::string& currency_code,
68 const base::Optional<std::string> currency_system, 68 const std::string& currency_system,
69 const std::string& locale_name) { 69 const std::string& locale_name) {
70 if (!currency_formatter_) { 70 if (!currency_formatter_) {
71 currency_formatter_.reset( 71 currency_formatter_.reset(
72 new CurrencyFormatter(currency_code, currency_system, locale_name)); 72 new CurrencyFormatter(currency_code, currency_system, locale_name));
73 } 73 }
74 74
75 return currency_formatter_.get(); 75 return currency_formatter_.get();
76 } 76 }
77 77
78 autofill::AutofillProfile* PaymentRequest::GetCurrentlySelectedProfile() { 78 autofill::AutofillProfile* PaymentRequest::GetCurrentlySelectedProfile() {
(...skipping 22 matching lines...) Expand all
101 cards.begin(), 101 cards.begin(),
102 cards.end(), 102 cards.end(),
103 [] (autofill::CreditCard* card) { 103 [] (autofill::CreditCard* card) {
104 return card->IsValid(); 104 return card->IsValid();
105 }); 105 });
106 106
107 return first_complete_card == cards.end() ? nullptr : *first_complete_card; 107 return first_complete_card == cards.end() ? nullptr : *first_complete_card;
108 } 108 }
109 109
110 } // namespace payments 110 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/payment_request.h ('k') | components/payments/payment_request.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698