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

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

Issue 2779283002: [Web Payments] Implement the CVC Unmask dialog. (Closed)
Patch Set: Rebase + add browser test 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 "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/autofill/core/browser/autofill_data_util.h" 10 #include "components/autofill/core/browser/autofill_data_util.h"
11 #include "components/autofill/core/browser/autofill_profile.h" 11 #include "components/autofill/core/browser/autofill_profile.h"
12 #include "components/autofill/core/browser/credit_card.h" 12 #include "components/autofill/core/browser/credit_card.h"
13 #include "components/autofill/core/browser/personal_data_manager.h" 13 #include "components/autofill/core/browser/personal_data_manager.h"
14 #include "components/payments/content/payment_request_delegate.h"
14 #include "components/payments/content/payment_request_spec.h" 15 #include "components/payments/content/payment_request_spec.h"
15 #include "components/payments/content/payment_response_helper.h" 16 #include "components/payments/content/payment_response_helper.h"
16 #include "components/payments/core/autofill_payment_instrument.h" 17 #include "components/payments/core/autofill_payment_instrument.h"
17 18
18 namespace payments { 19 namespace payments {
19 20
20 PaymentRequestState::PaymentRequestState( 21 PaymentRequestState::PaymentRequestState(
21 PaymentRequestSpec* spec, 22 PaymentRequestSpec* spec,
22 Delegate* delegate, 23 Delegate* delegate,
23 const std::string& app_locale, 24 const std::string& app_locale,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (!supported_card_networks.count(basic_card_network)) 177 if (!supported_card_networks.count(basic_card_network))
177 continue; 178 continue;
178 179
179 // TODO(crbug.com/701952): Should use the method name preferred by the 180 // TODO(crbug.com/701952): Should use the method name preferred by the
180 // merchant (either "basic-card" or the basic card network e.g. "visa"). 181 // merchant (either "basic-card" or the basic card network e.g. "visa").
181 182
182 // Copy the credit cards as part of AutofillPaymentInstrument so they are 183 // Copy the credit cards as part of AutofillPaymentInstrument so they are
183 // indirectly owned by this object. 184 // indirectly owned by this object.
184 std::unique_ptr<PaymentInstrument> instrument = 185 std::unique_ptr<PaymentInstrument> instrument =
185 base::MakeUnique<AutofillPaymentInstrument>( 186 base::MakeUnique<AutofillPaymentInstrument>(
186 basic_card_network, *card, shipping_profiles_, app_locale_); 187 basic_card_network, *card, shipping_profiles_, app_locale_,
188 delegate_->GetPaymentRequestDelegate());
187 available_instruments_.push_back(std::move(instrument)); 189 available_instruments_.push_back(std::move(instrument));
188 } 190 }
189 } 191 }
190 192
191 void PaymentRequestState::SetDefaultProfileSelections() { 193 void PaymentRequestState::SetDefaultProfileSelections() {
192 // Only pre-select an address if the merchant provided at least one selected 194 // Only pre-select an address if the merchant provided at least one selected
193 // shipping option. 195 // shipping option.
194 if (!shipping_profiles().empty() && spec_->selected_shipping_option()) 196 if (!shipping_profiles().empty() && spec_->selected_shipping_option())
195 selected_shipping_profile_ = shipping_profiles()[0]; 197 selected_shipping_profile_ = shipping_profiles()[0];
196 198
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 ->GetInfo(autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), 262 ->GetInfo(autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER),
261 app_locale_) 263 app_locale_)
262 .empty())) { 264 .empty())) {
263 return false; 265 return false;
264 } 266 }
265 267
266 return true; 268 return true;
267 } 269 }
268 270
269 } // namespace payments 271 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698