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

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

Issue 2779283002: [Web Payments] Implement the CVC Unmask dialog. (Closed)
Patch Set: 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_state.h" 5 #include "components/payments/content/payment_request_state.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "components/autofill/core/browser/autofill_data_util.h" 9 #include "components/autofill/core/browser/autofill_data_util.h"
10 #include "components/autofill/core/browser/autofill_profile.h" 10 #include "components/autofill/core/browser/autofill_profile.h"
11 #include "components/autofill/core/browser/credit_card.h" 11 #include "components/autofill/core/browser/credit_card.h"
12 #include "components/autofill/core/browser/personal_data_manager.h" 12 #include "components/autofill/core/browser/personal_data_manager.h"
13 #include "components/payments/content/payment_request_delegate.h"
13 #include "components/payments/content/payment_request_spec.h" 14 #include "components/payments/content/payment_request_spec.h"
14 #include "components/payments/core/autofill_payment_instrument.h" 15 #include "components/payments/core/autofill_payment_instrument.h"
15 16
16 namespace payments { 17 namespace payments {
17 18
18 PaymentRequestState::PaymentRequestState( 19 PaymentRequestState::PaymentRequestState(
19 PaymentRequestSpec* spec, 20 PaymentRequestSpec* spec,
20 Delegate* delegate, 21 Delegate* delegate,
21 const std::string& app_locale, 22 const std::string& app_locale,
22 autofill::PersonalDataManager* personal_data_manager) 23 autofill::PersonalDataManager* personal_data_manager)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 if (!supported_card_networks.count(basic_card_network)) 141 if (!supported_card_networks.count(basic_card_network))
141 continue; 142 continue;
142 143
143 // TODO(crbug.com/701952): Should use the method name preferred by the 144 // TODO(crbug.com/701952): Should use the method name preferred by the
144 // merchant (either "basic-card" or the basic card network e.g. "visa"). 145 // merchant (either "basic-card" or the basic card network e.g. "visa").
145 146
146 // Copy the credit cards as part of AutofillPaymentInstrument so they are 147 // Copy the credit cards as part of AutofillPaymentInstrument so they are
147 // indirectly owned by this object. 148 // indirectly owned by this object.
148 std::unique_ptr<PaymentInstrument> instrument = 149 std::unique_ptr<PaymentInstrument> instrument =
149 base::MakeUnique<AutofillPaymentInstrument>( 150 base::MakeUnique<AutofillPaymentInstrument>(
150 basic_card_network, *card, shipping_profiles_, app_locale_); 151 basic_card_network, *card, shipping_profiles_, app_locale_,
152 delegate_->GetPaymentRequestDelegate());
151 available_instruments_.push_back(std::move(instrument)); 153 available_instruments_.push_back(std::move(instrument));
152 } 154 }
153 } 155 }
154 156
155 void PaymentRequestState::SetDefaultProfileSelections() { 157 void PaymentRequestState::SetDefaultProfileSelections() {
156 if (!shipping_profiles().empty()) 158 if (!shipping_profiles().empty())
157 selected_shipping_profile_ = shipping_profiles()[0]; 159 selected_shipping_profile_ = shipping_profiles()[0];
158 160
159 if (!contact_profiles().empty()) 161 if (!contact_profiles().empty())
160 selected_contact_profile_ = contact_profiles()[0]; 162 selected_contact_profile_ = contact_profiles()[0];
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 spec_->details().shipping_options.rend(), 240 spec_->details().shipping_options.rend(),
239 [](const payments::mojom::PaymentShippingOptionPtr& element) { 241 [](const payments::mojom::PaymentShippingOptionPtr& element) {
240 return element->selected; 242 return element->selected;
241 }); 243 });
242 if (selected_shipping_option_it != spec_->details().shipping_options.rend()) { 244 if (selected_shipping_option_it != spec_->details().shipping_options.rend()) {
243 selected_shipping_option_ = selected_shipping_option_it->get(); 245 selected_shipping_option_ = selected_shipping_option_it->get();
244 } 246 }
245 } 247 }
246 248
247 } // namespace payments 249 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698